aboutsummaryrefslogtreecommitdiffstats
path: root/spec/factories.rb
blob: b09e41c5c40a04821f2ebb5f983caae7d382cf2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FactoryGirl.define do
  factory :company, :class => "Chouette::Company" do |company|
    company.sequence(:name) { |n| "Company #{n}" }
    company.sequence(:objectid) { |n| "test:Company:#{n}" }
    company.sequence(:registration_number) { |n| "test-#{n}" }

  end

  factory :line, :class => "Chouette::Line" do |line|
    line.sequence(:name) { |n| "Line #{n}" }
    line.sequence(:objectid) { |n| "test:Line:#{n}" }
    line.sequence(:transport_mode_name) { |n| "Bus" }

    line.association :network, :factory => :network
    line.association :company, :factory => :company

    line.sequence(:registration_number) { |n| "test-#{n}" }
  end

  factory :network, :class => "Chouette::Network" do |network|
    network.sequence(:name) { |n| "Network #{n}" }
    network.sequence(:objectid) { |n| "test:GroupOfLine:#{n}" }
    network.sequence(:registration_number) { |n| "test-#{n}" }

  end

  # factory :chouette_stop_area, :class => "Chouette::StopArea" do |f|
  #   f.latitude 10 * rand
  #   f.longitude 10 * rand
  #   f.sequence(:name) { |n| "StopArea #{n}" }
  #   f.areatype "CommercialStopPoint"
  #   f.objectid
  # end

  factory :referential do |f|
    f.sequence(:name) { |n| "Test #{n}" }
    f.sequence(:slug) { |n| "test_#{n}" }
  end

  factory :user do |f|
    f.sequence(:email) { |n| "chouette#{n}@dryade.priv" }
    f.password "secret"
    f.password_confirmation "secret"
  end

end