aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/import_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/import_spec.rb')
-rw-r--r--spec/models/import_spec.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 4e8aac3f4..3e4128865 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -128,7 +128,7 @@ RSpec.describe Import, type: :model do
it "updates :status to successful when all children are successful" do
workbench_import = create(:workbench_import)
- create_list(
+ imports = create_list(
:netex_import,
2,
parent: workbench_import,
@@ -140,7 +140,7 @@ 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
+ it "updates :status to failed when any child has failed" do
workbench_import = create(:workbench_import)
[
'failed',
@@ -158,6 +158,24 @@ RSpec.describe Import, type: :model do
expect(workbench_import.status).to eq('failed')
end
+ it "updates :status to warning when any child has warning or successful" do
+ workbench_import = create(:workbench_import)
+ [
+ 'warning',
+ 'successful'
+ ].each do |status|
+ create(
+ :netex_import,
+ parent: workbench_import,
+ status: status
+ )
+ end
+
+ workbench_import.update_status
+
+ expect(workbench_import.status).to eq('warning')
+ end
+
it "updates :ended_at to now when status is finished" do
workbench_import = create(:workbench_import)
create(