aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/import_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-08-01 19:45:59 +0200
committerTeddy Wing2017-08-01 19:45:59 +0200
commitf189c4331d4f6f1ed10b7545d90a92dc2b7ca9b1 (patch)
tree198d60c9f9aaac94bd922689277f0cf04698c80c /spec/models/import_spec.rb
parent240c2270ca8e21c75170d6b7764562c049ef661a (diff)
downloadchouette-core-f189c4331d4f6f1ed10b7545d90a92dc2b7ca9b1.tar.bz2
Import: Add #ready?
This boolean method answers whether or not the current import's `current_step` and `total_steps` fields match. If so, all of its subtasks are finished, in which case it can be thought of as "ready". Refs #4174, #3511
Diffstat (limited to 'spec/models/import_spec.rb')
-rw-r--r--spec/models/import_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 53513eb0c..1b8fe72c2 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -23,4 +23,26 @@ RSpec.describe Import, :type => :model do
netex_import.notify_parent
end
end
+
+ describe "#ready?" do
+ it "returns true if #current_step == #total_steps" do
+ import = build_stubbed(
+ :import,
+ total_steps: 4,
+ current_step: 4
+ )
+
+ expect(import.ready?).to be true
+ end
+
+ it "returns false if #current_step != #total_steps" do
+ import = build_stubbed(
+ :import,
+ total_steps: 6,
+ current_step: 3
+ )
+
+ expect(import.ready?).to be false
+ end
+ end
end