business_hours 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 536e3b9a59f875206a64d5674c42cb42c99d2302
4
- data.tar.gz: 1726cd657f953fdcbe831bff9f95bb270b72466e
3
+ metadata.gz: 9eab7fc33d4f5c7ab92c10c7185f241e76910da6
4
+ data.tar.gz: acf2edbb31f350200e98cfbeb897f5aee9a3d990
5
5
  SHA512:
6
- metadata.gz: f026d514d69af817f8afb1147bf2544f54bc402d3999ad0e1f49c62851adfa6b3306b99f04654ee924b2abc5816341aa462c69b12d7c03993fbd923c93fe544c
7
- data.tar.gz: db6e060a2541a6794fb44bbad6c342b21be7c3d1f14761b4770186dac11a14b63af4653368622e8c896fb6ce05f1301506878011b406cc5b233cc86f2f90e74d
6
+ metadata.gz: a2ea352f74174a55c1ff0d598f992e1023f93b6cec9702a7828f73376a082113bc154f51a78aa588643941be20a0f93abbb8001c0cf7fccf1adae948dc989555
7
+ data.tar.gz: 345f3d17276e1ccb75f79ed2092ed10a2d2a7b9dcb32858061315e1c2cb3b7bf15948f4d592d39fe6034670442c801fe32e263088632fb973c62e8071e22a516
@@ -63,7 +63,7 @@ module BusinessHours
63
63
  open = @open_at.change(day: time.day, month: time.month, year: time.year)
64
64
  close = @close_at.change(day: time.day, month: time.month, year: time.year)
65
65
 
66
- close = close.change(day: close.day + 1) if open > close
66
+ close = close + 1.day if open > close
67
67
 
68
68
  result = !time.between?(open, close)
69
69
 
@@ -1,3 +1,3 @@
1
1
  module BusinessHours
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -94,4 +94,16 @@ class TestBusinessHours < Test::Unit::TestCase
94
94
 
95
95
  Timecop.travel(Time.zone.now.change(hour: 21, minutes: 00, day: Date.today.day)) { assert_equal hours.closed?, false }
96
96
  end
97
+
98
+ def test_with_a_next_day_at_a_month_last_day
99
+ Timecop.freeze(Date.new(2014, 3, 31)) do
100
+ hours = BusinessHours::Week.new
101
+ hours.day(Date::ABBR_DAYNAMES[Date.today.wday]) do
102
+ open_at '20:00'
103
+ close_at '01:00'
104
+ end
105
+
106
+ Timecop.travel(Time.zone.now.change(hour: 21, minutes: 00, day: Date.today.day)) { assert_equal hours.closed?, false }
107
+ end
108
+ end
97
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business_hours
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kryak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-19 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler