aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/import_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-08-30 12:06:39 +0200
committerTeddy Wing2017-08-30 12:11:55 +0200
commitf81bfd7f8aaf2efd36615b904b58a78bdee1fa81 (patch)
treea31a939e05b6dbeb4f85b5aadee3bbf215168e23 /spec/models/import_spec.rb
parent597224492453bd4b9c12edb9379fd9947c73cf23 (diff)
downloadchouette-core-f81bfd7f8aaf2efd36615b904b58a78bdee1fa81.tar.bz2
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`.
Diffstat (limited to 'spec/models/import_spec.rb')
-rw-r--r--spec/models/import_spec.rb18
1 files changed, 7 insertions, 11 deletions
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"
)