business 3.1.0 → 3.2.0
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/CHANGELOG.md +4 -0
- data/lib/business/calendar.rb +7 -1
- data/lib/business/version.rb +1 -1
- data/spec/business/calendar_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40ea955d78824ad8e83d5265c4b291fb3b769a332d2783d42e933a94ad40923f
|
|
4
|
+
data.tar.gz: 1ae889aeea3e8649b8a53b616e0b2b0e3be400fb9879cbb3ffff4e2c4d7900bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b3b625612e5339fb10ef38ff80f0cb955596b9294d49eda5f96c60d5d647c7e90de292109f23d8df9d8aae2353be81bdd129f9f21f3927a58dc59ddb90b8f9d
|
|
7
|
+
data.tar.gz: ad28326f5d4ca2a556ceb4f132def2440815c187e77e3d13652008ac7975b31034db73e14ccf4e731e07b792b1254cfeb41a3eac8b6edd24b15c99ccfe77bd3f
|
data/CHANGELOG.md
CHANGED
data/lib/business/calendar.rb
CHANGED
|
@@ -209,7 +209,13 @@ module Business
|
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
def day_interval_for(date)
|
|
212
|
-
date.is_a?(Date)
|
|
212
|
+
if date.is_a?(Date)
|
|
213
|
+
1
|
|
214
|
+
elsif defined?(ActiveSupport::TimeWithZone) && date.is_a?(ActiveSupport::TimeWithZone)
|
|
215
|
+
1.day
|
|
216
|
+
else
|
|
217
|
+
3600 * 24
|
|
218
|
+
end
|
|
213
219
|
end
|
|
214
220
|
|
|
215
221
|
# Internal method for assigning working days from a calendar config.
|
data/lib/business/version.rb
CHANGED
|
@@ -1049,4 +1049,18 @@ RSpec.describe Business::Calendar do
|
|
|
1049
1049
|
|
|
1050
1050
|
it_behaves_like "common"
|
|
1051
1051
|
end
|
|
1052
|
+
|
|
1053
|
+
context "(using TimeWithZone objects)" do
|
|
1054
|
+
before do
|
|
1055
|
+
stub_const("ActiveSupport::TimeWithZone", Class.new(Time))
|
|
1056
|
+
Integer.define_method(:day) { self * 60 * 60 * 24 }
|
|
1057
|
+
end
|
|
1058
|
+
|
|
1059
|
+
after { Integer.remove_method(:day) }
|
|
1060
|
+
|
|
1061
|
+
let(:date_class) { ActiveSupport::TimeWithZone }
|
|
1062
|
+
let(:day_interval) { 1.day }
|
|
1063
|
+
|
|
1064
|
+
it_behaves_like "common"
|
|
1065
|
+
end
|
|
1052
1066
|
end
|