aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorTeddy Wing2017-08-30 18:18:53 +0200
committerTeddy Wing2017-08-30 18:19:24 +0200
commit327593b347390b174c696fa2cd1f90223f23475a (patch)
tree0d802c2f1edfe2b8228fedf8fe532c12a1348291 /spec/models
parent1886c0581fef1bd851710a1e15889ecd86b558b3 (diff)
downloadchouette-core-327593b347390b174c696fa2cd1f90223f23475a.tar.bz2
Import spec: Rewrite test that checks 'successful' status on parent
Getting rid of the other commented test that checks failure because that combination is no longer relevant and the basic failure cases are handled by the specs just above.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/import_spec.rb31
1 files changed, 13 insertions, 18 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 4d86c3195..22bbfab09 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -95,24 +95,19 @@ RSpec.describe Import, type: :model do
"canceled"
)
- # TODO: rewrite these for new #update_status
- # it "updates :status to successful when #ready?" do
- # expect(workbench_import).to receive(:update).with(status: 'successful')
- #
- # workbench_import.child_change
- # end
- #
- # it "updates :status to failed when #ready? and child is failed" do
- # build_stubbed(
- # :netex_import,
- # parent: workbench_import,
- # status: :failed
- # )
- #
- # expect(workbench_import).to receive(:update).with(status: 'failed')
- #
- # workbench_import.child_change
- # end
+ it "updates :status to successful when all children are successful" do
+ workbench_import = create(:workbench_import)
+ create_list(
+ :netex_import,
+ 2,
+ parent: workbench_import,
+ status: 'successful'
+ )
+
+ workbench_import.update_status
+
+ expect(workbench_import.status).to eq('successful')
+ end
it "updates :ended_at to now when status is finished" do
skip "Redo the `#update_status` code to make it easier to write this."