aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/import_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-08-30 18:23:29 +0200
committerTeddy Wing2017-08-30 18:23:29 +0200
commit7220c54b4ec097bd5d7292cb0b7a068ddb726a7c (patch)
tree12e9c45e2410bc8890464d704015c1683133d5d3 /spec/models/import_spec.rb
parent327593b347390b174c696fa2cd1f90223f23475a (diff)
downloadchouette-core-7220c54b4ec097bd5d7292cb0b7a068ddb726a7c.tar.bz2
Import spec: Add test for 'failed' with comination of child statuses
When any one of a parent import's children have failed, the parent import should get status 'failed'.
Diffstat (limited to 'spec/models/import_spec.rb')
-rw-r--r--spec/models/import_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 22bbfab09..2a0c7539e 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -109,6 +109,24 @@ RSpec.describe Import, type: :model do
expect(workbench_import.status).to eq('successful')
end
+ it "Updates :status to failed when any child has failed" do
+ workbench_import = create(:workbench_import)
+ [
+ 'failed',
+ 'successful'
+ ].each do |status|
+ create(
+ :netex_import,
+ parent: workbench_import,
+ status: status
+ )
+ end
+
+ workbench_import.update_status
+
+ expect(workbench_import.status).to eq('failed')
+ 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."
end