Skip to content

Instantly share code, notes, and snippets.

@radar
Created December 22, 2017 03:56
Show Gist options
  • Save radar/7e1523928b2bb0242e6bf18d8d1d6812 to your computer and use it in GitHub Desktop.
Save radar/7e1523928b2bb0242e6bf18d8d1d6812 to your computer and use it in GitHub Desktop.
FactoryBot.define do
factory :property, aliases: [:current_prop] do
is_active "true"
factory :nowhereland do
name "NowhereLand"
property_code 'nwlnd'
address "123 Nowhere Lane"
city "Erewhon"
state "Oblivion"
zip "48063"
end
factory :happyland do
name "HappyLand"
property_code 'hplnd'
address "123 Happy Lane"
city "Happyton"
state "Bliss"
zip "48063"
end
end
factory :building do
is_active true
association :nowhereland
factory :nowhereland_1 do
designation "NowhereLand 1"
end
factory :happy_1 do
designation "Happy 1"
end
end
factory :apt_type do
apt_type_name 'Some Layout'
association :nowhereland
is_active true
association :nowhereland_1
going_rate 699.00
none_type false
factory :nowhere_none_type do
apt_type_name 'Nowhere None Type'
going_rate 0.00
none_type true
end
factory :nowhere_studio do
apt_type_name 'Nowhere Studio'
going_rate 500.00
end
factory :happy_none_type do
apt_type_name 'Happy None Type'
going_rate 0.00
none_type true
end
factory :happy_studio do
apt_type_name 'Happy Studio'
going_rate 500.00
end
end
factory :apt do
apt "Some Unit Somewhere"
association :apt_type
association :nowhereland
factory :nowhere_101A do
apt "Nowhere: 101A"
association :nowhere_studio
end
factory :nowhere_none do
apt "Nowhere: None"
association :nowhere_none_type
end
factory :nowhere_move_in_ready do
apt "Nowhere: Move-in Ready"
association :nowhere_studio
association :nowhereland_1
end
## Similar set for Happy Land
factory :happy_none do
apt "Happy: None"
happy_none_type
end
factory :happy_101A do
apt "Happy: 101A"
happy_studio
end
factory :happy_move_in_ready do
apt "Happy: Move-in Ready"
happy_studio
happyland_1
end
end
factory :user do
association :current_prop, factory: :nowhereland
name 'syuser'
first_name "Yuser"
last_name "Some"
password "dumB_p455w0rd!"
initials "sy"
role "1"
email "[email protected]"
is_active "true"
factory :admin do
association :current_prop, factory: :nowhereland
name 'aadmin'
first_name 'Adam'
last_name 'Admin'
password 'sm4rT_p455w0rd!'
role "5"
email "[email protected]"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment