daily_affirmation 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/daily_affirmation/affirmations.rb +6 -0
- data/lib/daily_affirmation/version.rb +1 -1
- data/spec/daily_affirmation_spec.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 311e00301c5ac2fc0ef7137531472997e5f9668b
|
4
|
+
data.tar.gz: 6df1cba1e7c2560e5d2853dfc5600ce3bd74a0aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 135d36905bc518d3a39e1504d9d2ff4d2a42cc9055b8d206ef84abeb164fe7d78db17efe81e5db39bc5346008f9292a7acae1553b87cad1695504cdaf31e4085
|
7
|
+
data.tar.gz: 67c1b7f3a369dfb7732d97391b824b3d4290127a867f35db5ebdb5fe07f795fa75c7bd6689da7162699435c7b7b8b86a34776b77ee16cafc0ac6b07aa6916ac5
|
@@ -119,6 +119,12 @@ module DailyAffirmation
|
|
119
119
|
}.merge(opts)
|
120
120
|
end
|
121
121
|
|
122
|
+
def affirms_valid_date(attribute, opts = {})
|
123
|
+
affirmations << {
|
124
|
+
:attribute => attribute, :type => :date
|
125
|
+
}.merge(opts)
|
126
|
+
end
|
127
|
+
|
122
128
|
def affirms(attribute, opts = {})
|
123
129
|
affirmations << {
|
124
130
|
:attribute => attribute, :type => :custom
|
@@ -98,20 +98,22 @@ describe DailyAffirmation do
|
|
98
98
|
affirms_length_of :password, :range => 8..40
|
99
99
|
affirms_numericality_of :age
|
100
100
|
affirms_presence_of :name
|
101
|
+
affirms_valid_date :created_at
|
101
102
|
affirms :name, :proc => Proc.new { |object|
|
102
103
|
object.name == "Bobby Tabbles"
|
103
104
|
}
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
107
|
-
it "
|
108
|
+
it "correctly sets up affirmations" do
|
108
109
|
obj = double(
|
109
110
|
:conflicts => nil,
|
110
111
|
:eula => true,
|
111
112
|
:password => "test1234",
|
112
113
|
:password_confirmation => "test1234",
|
113
114
|
:age => 19,
|
114
|
-
:name => "Bobby Tabbles"
|
115
|
+
:name => "Bobby Tabbles",
|
116
|
+
:created_at => "1981-11-28"
|
115
117
|
)
|
116
118
|
|
117
119
|
affirmation = cls.new(obj)
|