smarter_dates 0.2.7.11 → 0.2.7.12

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.
@@ -44,7 +44,7 @@ def self.included( klass ) # :nodoc:
44
44
  rescue
45
45
  dt = val
46
46
  end
47
- if defined?(Rails)
47
+ if defined?(Rails) && dt
48
48
  if k.match(/_(?:on|d)$/)
49
49
  self[k] = dt.to_date
50
50
  else
@@ -1,4 +1,4 @@
1
1
  module SmarterDates
2
- VERSION = '0.2.7.11'
2
+ VERSION = '0.2.7.12'
3
3
  end
4
4
 
@@ -49,6 +49,18 @@ class SmarterDatesTest < Test::Unit::TestCase
49
49
  assert_equal yesterday.year, @model.updated_at.year
50
50
  assert_equal yesterday.month, @model.updated_at.mon
51
51
  assert_equal yesterday.day, @model.updated_at.mday
52
+ assert_equal yesterday.day, @model.updated_at.mday
53
+ end
54
+
55
+ def test_parsing_failures
56
+ @model.birth_d = "32 April 1976"
57
+ assert_equal nil, @model.birth_d
58
+
59
+ # TODO: fix this in chronic
60
+ if false
61
+ @model.birth_d = "30 Feb 1976"
62
+ assert_equal nil, @model.birth_d
63
+ end
52
64
  end
53
65
  end
54
66
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: smarter_dates
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.7.11
5
+ version: 0.2.7.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Belt