Skip to content

Commit

Permalink
Failing test cases for issues bokmann#36, bokmann#45 and bokmann#83
Browse files Browse the repository at this point in the history
  • Loading branch information
dugjason committed Oct 19, 2015
1 parent 2ba148c commit 81788e0
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions test/test_business_days.rb
Expand Up @@ -75,27 +75,57 @@
expected = Time.parse("April 8th, 2010, 11:00 am")
assert_equal expected, before
end


it "should return a business hour when adding one business day from before business hours" do
wednesday = Time.parse("Wednesday October 14th, 2015, 01:54 am")
later = 1.business_days.after(wednesday)
expected = Time.parse("Thursday October 15th, 2015, 09:00 am")
assert_equal expected, later
end

it "should return a business hour when adding one business day from after business hours" do
wednesday = Time.parse("Wednesday October 14th, 2015, 21:54 pm")
later = 1.business_days.after(wednesday)
expected = Time.parse("Friday October 16th, 2015, 09:00 am")
assert_equal expected, later
end

it "should return a business hour when subtracting one business day from before business hours" do
wednesday = Time.parse("Wednesday October 14th, 2015, 01:54 am")
before = 1.business_days.before(wednesday)
expected = Time.parse("Monday October 12th, 2015, 09:00 am")
assert before.during_business_hours?
assert_equal expected, before
end

it "should return a business hour when subtracting one business day from after business hours" do
wednesday = Time.parse("Wednesday October 14th, 2015, 21:54 pm")
before = 1.business_days.before(wednesday)
expected = Time.parse("Tuesday October 13th, 2015, 09:00 am")
assert before.during_business_hours?
assert_equal expected, before
end

it "responds appropriatly to <" do
assert 5.business_days < 10.business_days
assert !(10.business_days < 5.business_days)
end

it "responds appropriatly to >" do
assert !(5.business_days > 10.business_days)
assert 10.business_days > 5.business_days
end

it "responds appropriatly to ==" do
assert 5.business_days == 5.business_days
assert 10.business_days != 5.business_days
end

it "won't compare days to hours" do
assert_raises ArgumentError do
5.business_days < 5.business_hours
end
end

end
end

0 comments on commit 81788e0

Please sign in to comment.