aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/import_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-08-30 11:46:55 +0200
committerTeddy Wing2017-08-30 11:52:47 +0200
commit326275bdb3729877cb6b5ffb6ec74e0649a1dcdc (patch)
tree47c7cd8cb5f557616f70a4421a8b27f8856c9beb /spec/models/import_spec.rb
parent64c09eebdf75dd4ecb14be87e9f7710c3cd0f7b1 (diff)
downloadchouette-core-326275bdb3729877cb6b5ffb6ec74e0649a1dcdc.tar.bz2
Import spec: Move most `#child_change` specs to `#update_status`
The new `#child_change` doesn't do a whole lot, so the specs that used to test it don't belong any more. Update them so they test `#update_status` instead, where this logic now lives.
Diffstat (limited to 'spec/models/import_spec.rb')
-rw-r--r--spec/models/import_spec.rb37
1 files changed, 18 insertions, 19 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 46fd8e8b2..08a3c81c0 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -48,8 +48,23 @@ RSpec.describe Import, type: :model do
end
end
- # TODO: Move most of these to #update_status
describe "#child_change" do
+ it "calls #update_status" do
+ allow(workbench_import).to receive(:update)
+
+ expect(workbench_import).to receive(:update_status)
+ workbench_import.child_change
+ end
+
+ it "calls #update_referentials" do
+ allow(workbench_import).to receive(:update)
+
+ expect(workbench_import).to receive(:update_referentials)
+ workbench_import.child_change
+ end
+ end
+
+ describe "#update_status" do
shared_examples(
"updates :status to failed when child status indicates failure"
) do |failure_status|
@@ -68,7 +83,7 @@ RSpec.describe Import, type: :model do
status: 'failed'
)
- workbench_import.child_change
+ workbench_import.update_status
end
end
end
@@ -119,7 +134,7 @@ RSpec.describe Import, type: :model do
expect(workbench_import).not_to receive(:update)
- workbench_import.child_change
+ workbench_import.update_status
end
end
@@ -140,22 +155,6 @@ RSpec.describe Import, type: :model do
"canceled"
)
- it "calls #update_status" do
- allow(workbench_import).to receive(:update)
-
- expect(workbench_import).to receive(:update_status)
- workbench_import.child_change
- end
-
- it "calls #update_referentials" do
- allow(workbench_import).to receive(:update)
-
- expect(workbench_import).to receive(:update_referentials)
- workbench_import.child_change
- end
- end
-
- describe "#update_status" do
it "updates :ended_at to now when status is finished" do
skip "Redo the `#update_status` code to make it easier to write this."
end