Sha256: 37b959dad8a5c17f367fc69158f3f6d0bfabd834eba6932357da574c6303aed7

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

FactoryBot.define do
  factory :region do
    name { Faker::Australia.location } # Faker::App.name
    settings { Faker::Json.shallow_json(width: 3, options: { key: 'Name.first_name', value: 'Name.last_name' }) }

    # These traits are used to define well known variations of a factory
    trait :western_sydney do
      name { 'Western Sydney' }
      settings { { 'suburbs' => ['Blacktown', 'Parramatta', 'Penrith', 'Campbelltown', 'Liverpool'] } }
    end

    trait :sydney do
      name { 'Sydney CBD' }
      settings { { 'suburbs' => ['Sydney', 'Sydney CBD', 'Surry Hills', 'Darling Harbour', 'Barangaroo'] } }
    end

    trait :eastern_suburbs do
      name { 'Eastern Suburbs' }
      settings { { 'suburbs' => ['Bondi', 'Bondi Beach', 'Bondi Junction', 'Bronte', 'Coogee', 'Darlinghurst'] }}
    end

    trait :inner_west do
      name { 'Inner West' }
      settings { { 'suburbs' => ['Ashfield', 'Burwood', 'Campsie', 'Croydon', 'Newtown'] } }
    end

    trait :north_shore do
      name { 'North Shore' }
      settings { { 'suburbs' => ['Pymble', 'Castle Cove', 'Castlecrag', 'Chatswood', 'Crows Nest', 'Cremorne'] } }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 after_templates/addons/factory_bot/custom_factories/region.rb
rails_app_generator-0.3.5 after_templates/addons/factory_bot/custom_factories/region.rb
rails_app_generator-0.3.4 after_templates/addons/factory_bot/custom_factories/region.rb
rails_app_generator-0.3.3 after_templates/addons/factory_bot/custom_factories/region.rb