aboutsummaryrefslogtreecommitdiffstats
path: root/spec/factories/imports.rb
blob: e07447b60ac4eaddc98d976ae56bc17d2493af3b (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
FactoryGirl.define do
  factory :import do
    sequence(:name) { |n| "Import #{n}" }
    current_step_id "MyString"
    current_step_progress 1.5
    association :workbench
    association :referential
    file {File.open(File.join(Rails.root, 'spec', 'fixtures', 'OFFRE_TRANSDEV_2017030112251.zip'))}
    status :new
    started_at nil
    ended_at nil
    creator 'rspec'

    after(:build) do |import|
      import.class.skip_callback(:create, :before, :initialize_fields)
    end
  end

  factory :bad_import do
    sequence(:name) { |n| "Import #{n}" }
    current_step_id "MyString"
    current_step_progress 1.5
    association :workbench
    association :referential
    file {File.open(File.join(Rails.root, 'spec', 'fixtures', 'terminated_job.json'))}
    status :new
    started_at nil
    ended_at nil
    creator 'rspec'

    after(:build) do |import|
      import.class.skip_callback(:create, :before, :initialize_fields)
    end
  end
end