validates_timeliness 3.0.2 → 3.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.
data/CHANGELOG.rdoc
CHANGED
@@ -72,9 +72,8 @@ module ValidatesTimeliness
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def attribute_raw_value(record, attr_name)
|
75
|
-
|
75
|
+
record.respond_to?(:_timeliness_raw_value_for) &&
|
76
76
|
record._timeliness_raw_value_for(attr_name)
|
77
|
-
end
|
78
77
|
end
|
79
78
|
|
80
79
|
def timezone_aware?(record, attr_name)
|
@@ -22,6 +22,10 @@ describe ValidatesTimeliness::Conversion do
|
|
22
22
|
it "should return date part of datetime value" do
|
23
23
|
type_cast_value(DateTime.new(2010, 1, 1, 0, 0, 0), :date).should == Date.new(2010, 1, 1)
|
24
24
|
end
|
25
|
+
|
26
|
+
it 'should return nil for invalid value types' do
|
27
|
+
type_cast_value(12, :date).should == nil
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
describe "for time type" do
|
@@ -40,6 +44,10 @@ describe ValidatesTimeliness::Conversion do
|
|
40
44
|
it "should return dummy date with time part for datetime value" do
|
41
45
|
type_cast_value(DateTime.civil_from_format(:utc, 2010, 1, 1, 12, 34, 56), :time).should == Time.utc(2000, 1, 1, 12, 34, 56)
|
42
46
|
end
|
47
|
+
|
48
|
+
it 'should return nil for invalid value types' do
|
49
|
+
type_cast_value(12, :time).should == nil
|
50
|
+
end
|
43
51
|
end
|
44
52
|
|
45
53
|
describe "for datetime type" do
|
@@ -63,6 +71,10 @@ describe ValidatesTimeliness::Conversion do
|
|
63
71
|
result.should == Time.zone.local(2010, 1, 1, 23, 34, 56)
|
64
72
|
result.zone.should == 'EST'
|
65
73
|
end
|
74
|
+
|
75
|
+
it 'should return nil for invalid value types' do
|
76
|
+
type_cast_value(12, :datetime).should == nil
|
77
|
+
end
|
66
78
|
end
|
67
79
|
|
68
80
|
describe "ignore_usec option" do
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{validates_timeliness}
|
5
|
-
s.version = "3.0.
|
5
|
+
s.version = "3.0.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Adam Meehan"]
|
9
|
-
s.date = %q{2010-12-
|
9
|
+
s.date = %q{2010-12-11}
|
10
10
|
s.description = %q{Date and time validation plugin for Rails which allows custom formats}
|
11
11
|
s.email = %q{adam.meehan@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "LICENSE"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_timeliness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 3
|
10
|
+
version: 3.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Meehan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-11 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|