Skip to content

Instantly share code, notes, and snippets.

@orangewolf
Forked from testflyjets/apollo_factories
Last active January 1, 2016 11:29
Show Gist options
  • Save orangewolf/8138201 to your computer and use it in GitHub Desktop.
Save orangewolf/8138201 to your computer and use it in GitHub Desktop.
class Flight
has_many :locations
has_many :events
validates_uniqeness :flight_number
end
class Event
belongs_to :location
end
class Location
has_many :events
belongs_to :flight
end
FactoryGirl.define do
sequence(:flt_number) {|n| n }
factory :flight do
name "Testing"
flt_number
contact "Rich Eagledell"
email "[email protected]"
address1 "P.O. Box 2233"
city "MCAS Miramar"
state "CA"
zip "92040"
active true
description "San Diego's first Daedalians flight"
end
factory :location do
flight
location_name "Miramar Club"
address "2233 Gunny Street"
city "La Jolla"
state "CA"
phone "858-555-1212"
map_url "http://maps.google.com"
directions "Follow the map"
default_instructions "Cash, check or Apollo online payment"
end
factory :event do
flight
location
member
event_name "January 2014 Meeting"
headline "Start the New Year out right!"
description "We'll be meeting at the Club to kick-off a great new year"
start_time Time.new(2014, 1, 9, 11, 30)
end_time Time.new(2014, 1, 9, 14, 0)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment