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 +4 -4
- data/lib/business_hours/day.rb +1 -1
- data/lib/business_hours/version.rb +1 -1
- data/test/test_business_hours.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eab7fc33d4f5c7ab92c10c7185f241e76910da6
|
4
|
+
data.tar.gz: acf2edbb31f350200e98cfbeb897f5aee9a3d990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ea352f74174a55c1ff0d598f992e1023f93b6cec9702a7828f73376a082113bc154f51a78aa588643941be20a0f93abbb8001c0cf7fccf1adae948dc989555
|
7
|
+
data.tar.gz: 345f3d17276e1ccb75f79ed2092ed10a2d2a7b9dcb32858061315e1c2cb3b7bf15948f4d592d39fe6034670442c801fe32e263088632fb973c62e8071e22a516
|
data/lib/business_hours/day.rb
CHANGED
@@ -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
|
66
|
+
close = close + 1.day if open > close
|
67
67
|
|
68
68
|
result = !time.between?(open, close)
|
69
69
|
|
data/test/test_business_hours.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|