From f81bfd7f8aaf2efd36615b904b58a78bdee1fa81 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 30 Aug 2017 12:06:39 +0200 Subject: Import spec: Update status set to 'failed' tests The name doesn't really match what's happening, since no `child` is passed in as an argument any more. This just always happens any time there are one or more failing children. Remove the mock expectation because the extra fields don't really relate to what we're supposed to be testing here, namely `status`. --- spec/models/import_spec.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'spec/models/import_spec.rb') diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index 7ab5c7b30..8614d6ec8 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -66,9 +66,9 @@ RSpec.describe Import, type: :model do describe "#update_status" do shared_examples( - "updates :status to failed when child status indicates failure" + "updates :status to failed when >=1 child has failing status" ) do |failure_status| - it "updates :status to failed when child status indicates failure" do + it "updates :status to failed when >=1 child has failing status" do workbench_import = create(:workbench_import) create( :netex_import, @@ -77,27 +77,23 @@ RSpec.describe Import, type: :model do ) Timecop.freeze(Time.now) do - expect(workbench_import).to receive(:update).with( - current_step: 1, - ended_at: Time.now, - status: 'failed' - ) - workbench_import.update_status + + expect(workbench_import.status).to eq('failed') end end end include_examples( - "updates :status to failed when child status indicates failure", + "updates :status to failed when >=1 child has failing status", "failed" ) include_examples( - "updates :status to failed when child status indicates failure", + "updates :status to failed when >=1 child has failing status", "aborted" ) include_examples( - "updates :status to failed when child status indicates failure", + "updates :status to failed when >=1 child has failing status", "canceled" ) -- cgit v1.2.3