aboutsummaryrefslogtreecommitdiffstats
path: root/spec/factories/referentials.rb
blob: bbaa7c313b277de8981660f2de673c30777c27b1 (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
FactoryGirl.define do
  factory :referential do
    sequence(:name) { |n| "Test #{n}" }
    sequence(:slug) { |n| "test_#{n}" }
    sequence(:prefix) { |n| "test_#{n}" }
    association :line_referential
    association :stop_area_referential
    association :organisation
    time_zone "Europe/Paris"
    ready { true }
    objectid_format "stif_netex"
    transient do
      status :active
    end

    after(:create) do |referential, evaluator|
      referential.send "#{evaluator.status}!"
    end

    factory :workbench_referential do
      association :workbench
      before :create do | ref |
        ref.workbench.organisation = ref.organisation
      end
    end
  end
end