diff options
| author | Teddy Wing | 2017-08-28 18:43:34 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-08-28 18:43:34 +0200 | 
| commit | e065cf5696aec68c621e5ea7c26de01c6c8b201b (patch) | |
| tree | 86c1a0bae0edc85d8dac1c09a4afa2d27164d9d8 /spec/models/import_spec.rb | |
| parent | 4489051e192d151edee3d0820f3db93caceacc74 (diff) | |
| download | chouette-core-e065cf5696aec68c621e5ea7c26de01c6c8b201b.tar.bz2 | |
Import spec: Fix mock arguments
* The `allow` on the first line didn't appear to be necessary
* Need to use `create` instead of `build_stubbed` in order to provide
  access to the `children` relation
* The `#update` method gets called with a hash of arguments now,
  containing `current_step` and `status`. Update the mock to match the
  new code.
Diffstat (limited to 'spec/models/import_spec.rb')
| -rw-r--r-- | spec/models/import_spec.rb | 10 | 
1 files changed, 6 insertions, 4 deletions
| diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index b5424c756..9a9d7326d 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -53,15 +53,17 @@ RSpec.describe Import, :type => :model do        "updates :status to failed when child status indicates failure"      ) do |failure_status|        it "updates :status to failed when child status indicates failure" do -        allow(workbench_import).to receive(:update) - -        build_stubbed( +        workbench_import = create(:workbench_import) +        create(            :netex_import,            parent: workbench_import,            status: failure_status          ) -        expect(workbench_import).to receive(:update).with(status: 'failed') +        expect(workbench_import).to receive(:update).with( +          current_step: 1, +          status: 'failed' +        )          workbench_import.child_change        end | 
