BillyRuffian / faker_maker

FakerMaker is a simple factory builder so you can throw away your fixtures and generate test data instead.
https://billyruffian.github.io/faker_maker/
MIT License
9 stars 1 forks source link

Auto build when attribute that are declared as factories #57

Open AlexO-123 opened 9 months ago

AlexO-123 commented 9 months ago
FakerMaker.factory :structured_address do
  buildingName { Faker::Address.building_number }
  thoroughfareName { Faker::Address.street_name }
  country { ['Wales', 'Scotland', 'Northern Ireland', 'England'].sample }
  postcode { Faker::Address.postcode }
  language { %w[EN CY].sample }
  postTown { Faker::Address.city }
end

FakerMaker.factory :user do
  name { Faker::Name.name }
  email { Faker::Internet.email }
  address { FakerMaker[:structured_address]}
end

FM[:user].build should also build the address

BillyRuffian commented 2 months ago

added to v2.1.0