Adapt factories to use a wedding object
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 1m11s
Add copyright notice / copyright_notice (pull_request) Successful in 1m38s
Run unit tests / unit_tests (pull_request) Successful in 4m35s

This commit is contained in:
Manuel Bustillo 2024-12-01 09:58:39 +01:00
parent e4dad698ea
commit 8429b3952b
7 changed files with 13 additions and 3 deletions

View File

@ -2,6 +2,7 @@
FactoryBot.define do
factory :expense do
wedding
sequence(:name) { |i| "Expense #{i}" }
pricing_type { "fixed" }
amount { 100 }

View File

@ -2,6 +2,7 @@
FactoryBot.define do
factory :group do
wedding
sequence(:name) { |i| "Group #{i}" }
order { 1 }
end

View File

@ -2,7 +2,8 @@
FactoryBot.define do
factory :guest do
association :group
group
wedding
name { Faker::Name.name }
phone { Faker::PhoneNumber.cell_phone }

View File

@ -0,0 +1,6 @@
FactoryBot.define do
factory :tables_arrangement do
wedding
end
end

View File

@ -2,6 +2,6 @@
FactoryBot.define do
factory :user do
wedding
end
end

View File

@ -2,6 +2,7 @@
FactoryBot.define do
factory :wedding do
sequence(:slug) { |i| "wedding-#{i}" }
date { 1.year.from_now }
end
end

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe TablesArrangement, type: :model do
describe 'callbacks' do
it 'assigns a name before creation' do
expect(described_class.create!.name).to be_present
expect(create(:tables_arrangement).name).to be_present
end
end
end