time_of_day_attr 0.0.7 → 0.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab0ac090f636ee04c329736bd7f775f40fd65ba4
|
4
|
+
data.tar.gz: d7feee73d836a73b72f857b474b0489bea6a9e5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1110a3aec230b82a7483d0cc31d410e61a7f9c294a44f22b7d34bf1463fd5ae36e9ca78932672ca0dd623f72b49359efb5aaadeed1eec64c4a8775edc8d47079
|
7
|
+
data.tar.gz: 9867243a77fbc695403ddee5b8c8e55d49ea14df4ae5bb9967fd327e2860ad3201ba64c4840c4861f82ec6f3db19e3e5e6ca68d1790310c231f4c94fae0a1e1d
|
@@ -18,9 +18,10 @@ module TimeOfDayAttr
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
delocalized_value = delocalized_values.compact.first
|
21
|
-
|
21
|
+
super(delocalized_value)
|
22
|
+
else
|
23
|
+
super(value)
|
22
24
|
end
|
23
|
-
super(delocalized_value || value)
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -40,19 +40,14 @@ class TimeOfDayAttrTest < ActiveSupport::TestCase
|
|
40
40
|
assert_equal 61200, business_hour.closing
|
41
41
|
end
|
42
42
|
|
43
|
-
test 'time of day attr setter should
|
44
|
-
|
45
|
-
business_hour = BusinessHour.new(opening: 'Nine', closing: 'Five')
|
46
|
-
end
|
47
|
-
business_hour = BusinessHour.new
|
43
|
+
test 'time of day attr setter should ignore invalid formats' do
|
44
|
+
business_hour = BusinessHour.new(opening: 'Nine', closing: 'Five')
|
48
45
|
assert_nil business_hour.opening
|
49
46
|
assert_nil business_hour.closing
|
50
47
|
business_hour.opening = '9'
|
51
48
|
assert_equal 32400, business_hour.opening
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
assert_equal 32400, business_hour.opening
|
49
|
+
business_hour.opening = 'Nine'
|
50
|
+
assert_nil business_hour.opening
|
56
51
|
business_hour.opening = '9:30'
|
57
52
|
assert_equal 34200, business_hour.opening
|
58
53
|
business_hour.opening = 55800
|