aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/time_duration_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/time_duration_spec.rb b/spec/lib/time_duration_spec.rb
index 2d63eba76..1cba1f6d5 100644
--- a/spec/lib/time_duration_spec.rb
+++ b/spec/lib/time_duration_spec.rb
@@ -14,6 +14,20 @@ describe TimeDuration do
t2 = Time.now + (4.hours + 1.minutes)
expect(TimeDuration.exceeds_gap?(4.hours, t1, t2)).to be_truthy
end
+
+ it "returns true when `earlier` is later than `later`" do
+ earlier = Time.new(2000, 1, 1, 11, 0, 0, 0)
+ later = Time.new(2000, 1, 1, 12, 0, 0, 0)
+
+ expect(TimeDuration.exceeds_gap?(4.hours, later, earlier)).to be true
+ end
+
+ it "returns false when `earlier` == `later`" do
+ earlier = Time.new(2000, 1, 1, 1, 0, 0, 0)
+ later = earlier
+
+ expect(TimeDuration.exceeds_gap?(4.hours, later, earlier)).to be false
+ end
end
end
end