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: 918454e7a1335742ab83a0756f6a736976f997a1
4
- data.tar.gz: 5c8561a4f1d40431c167c1b75eed948bf56e1043
3
+ metadata.gz: ab0ac090f636ee04c329736bd7f775f40fd65ba4
4
+ data.tar.gz: d7feee73d836a73b72f857b474b0489bea6a9e5c
5
5
  SHA512:
6
- metadata.gz: e27f14a0adf5295b5d0681963d932e40ae79f1999e4055e8ae497bd63be7809c084d37e3489b51a0319774136105ce4ba05206829502a2b7d0fa11ff1aaea871
7
- data.tar.gz: 967e0f9f3f3e5ef2f459112fdb3652dbea0eed12e96d506b381fc08a5b9d3e70e86b0d01cf271bfd3518cead2e8beebf3c792fb1a2a08cb4903b9a9d44630969
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
- raise(ArgumentError, "invalid time of day #{value} for formats #{options[:formats].join(', ')}") unless delocalized_value
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
@@ -1,3 +1,3 @@
1
1
  module TimeOfDayAttr
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  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 raise invalid formats' do
44
- assert_raise ArgumentError do
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
- assert_raise ArgumentError do
53
- business_hour.opening = 'Nine'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_of_day_attr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clemens Teichmann