remarkable_activerecord 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/CHANGELOG +140 -138
  2. data/LICENSE +20 -20
  3. data/README +80 -80
  4. data/lib/remarkable_activerecord.rb +29 -29
  5. data/lib/remarkable_activerecord/base.rb +248 -237
  6. data/lib/remarkable_activerecord/describe.rb +27 -27
  7. data/lib/remarkable_activerecord/human_names.rb +36 -36
  8. data/lib/remarkable_activerecord/matchers/accept_nested_attributes_for_matcher.rb +30 -30
  9. data/lib/remarkable_activerecord/matchers/allow_mass_assignment_of_matcher.rb +59 -59
  10. data/lib/remarkable_activerecord/matchers/allow_values_for_matcher.rb +85 -94
  11. data/lib/remarkable_activerecord/matchers/association_matcher.rb +283 -283
  12. data/lib/remarkable_activerecord/matchers/have_column_matcher.rb +68 -68
  13. data/lib/remarkable_activerecord/matchers/have_default_scope_matcher.rb +38 -38
  14. data/lib/remarkable_activerecord/matchers/have_index_matcher.rb +73 -73
  15. data/lib/remarkable_activerecord/matchers/have_readonly_attributes_matcher.rb +30 -30
  16. data/lib/remarkable_activerecord/matchers/have_scope_matcher.rb +85 -85
  17. data/lib/remarkable_activerecord/matchers/validate_acceptance_of_matcher.rb +50 -50
  18. data/lib/remarkable_activerecord/matchers/validate_associated_matcher.rb +97 -97
  19. data/lib/remarkable_activerecord/matchers/validate_confirmation_of_matcher.rb +44 -44
  20. data/lib/remarkable_activerecord/matchers/validate_exclusion_of_matcher.rb +53 -53
  21. data/lib/remarkable_activerecord/matchers/validate_inclusion_of_matcher.rb +52 -52
  22. data/lib/remarkable_activerecord/matchers/validate_length_of_matcher.rb +150 -150
  23. data/lib/remarkable_activerecord/matchers/validate_numericality_of_matcher.rb +181 -181
  24. data/lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb +29 -29
  25. data/lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb +233 -233
  26. data/locale/en.yml +261 -261
  27. data/spec/accept_nested_attributes_for_matcher_spec.rb +1 -1
  28. data/spec/allow_mass_assignment_of_matcher_spec.rb +90 -82
  29. data/spec/allow_values_for_matcher_spec.rb +72 -63
  30. data/spec/association_matcher_spec.rb +612 -612
  31. data/spec/describe_spec.rb +3 -3
  32. data/spec/have_column_matcher_spec.rb +73 -73
  33. data/spec/have_default_scope_matcher_spec.rb +1 -1
  34. data/spec/have_index_matcher_spec.rb +87 -87
  35. data/spec/have_readonly_attributes_matcher_spec.rb +47 -47
  36. data/spec/have_scope_matcher_spec.rb +77 -77
  37. data/spec/model_builder.rb +101 -101
  38. data/spec/rcov.opts +1 -1
  39. data/spec/spec.opts +4 -4
  40. data/spec/spec_helper.rb +27 -27
  41. data/spec/validate_acceptance_of_matcher_spec.rb +68 -68
  42. data/spec/validate_associated_matcher_spec.rb +121 -121
  43. data/spec/validate_confirmation_of_matcher_spec.rb +58 -58
  44. data/spec/validate_length_of_matcher_spec.rb +218 -218
  45. data/spec/validate_numericality_of_matcher_spec.rb +179 -179
  46. data/spec/validate_presence_of_matcher_spec.rb +56 -56
  47. data/spec/validate_uniqueness_of_matcher_spec.rb +164 -164
  48. metadata +5 -5
data/locale/en.yml CHANGED
@@ -1,264 +1,264 @@
1
- en:
2
- remarkable:
3
- active_record:
4
- describe:
5
- each: "{{key}} is {{value}}"
6
- prepend: "when "
7
- connector: " and "
8
- expectations:
9
- allow_nil: "{{subject_name}} to {{not}}allow nil values for {{attribute}}"
1
+ en:
2
+ remarkable:
3
+ active_record:
4
+ describe:
5
+ each: "{{key}} is {{value}}"
6
+ prepend: "when "
7
+ connector: " and "
8
+ expectations:
9
+ allow_nil: "{{subject_name}} to {{not}}allow nil values for {{attribute}}"
10
10
  allow_blank: "{{subject_name}} to {{not}}allow blank values for {{attribute}}"
11
- optionals:
12
- allow_nil:
13
- positive: "allowing nil values"
14
- negative: "not allowing nil values"
15
- allow_blank:
16
- positive: "allowing blank values"
17
- negative: "not allowing blank values"
18
-
19
- accept_nested_attributes_for:
20
- description: "accept nested attributes for {{associations}}"
21
- expectations:
22
- association_exists: "{{subject_name}} to have association {{association}}, but does not"
23
- is_autosave: "{{subject_name}} to have association {{association}} with autosave true, got false"
24
- responds_to_attributes: "{{subject_name}} to respond to :{{association}}_attributes=, but does not"
25
- allows_destroy: "{{subject_name}} with allow destroy equals to {{allow_destroy}}, got {{actual}}"
26
- accepts: "{{subject_name}} to accept attributes {{attributes}} for {{association}}, but does not"
27
- rejects: "{{subject_name}} to reject attributes {{attributes}} for {{association}}, but does not"
28
- optionals:
29
- allow_destroy:
30
- positive: "allowing destroy"
31
- negative: "not allowing destroy"
32
- accept:
33
- positive: "accepting {{sentence}}"
34
- reject:
35
- positive: "rejecting {{sentence}}"
36
-
37
- allow_values_for:
38
- description: "allow {{in}} as values for {{attributes}}"
39
- expectations:
11
+ optionals:
12
+ allow_nil:
13
+ positive: "allowing nil values"
14
+ negative: "not allowing nil values"
15
+ allow_blank:
16
+ positive: "allowing blank values"
17
+ negative: "not allowing blank values"
18
+
19
+ accept_nested_attributes_for:
20
+ description: "accept nested attributes for {{associations}}"
21
+ expectations:
22
+ association_exists: "{{subject_name}} to have association {{association}}, but does not"
23
+ is_autosave: "{{subject_name}} to have association {{association}} with autosave true, got false"
24
+ responds_to_attributes: "{{subject_name}} to respond to :{{association}}_attributes=, but does not"
25
+ allows_destroy: "{{subject_name}} with allow destroy equals to {{allow_destroy}}, got {{actual}}"
26
+ accepts: "{{subject_name}} to accept attributes {{attributes}} for {{association}}, but does not"
27
+ rejects: "{{subject_name}} to reject attributes {{attributes}} for {{association}}, but does not"
28
+ optionals:
29
+ allow_destroy:
30
+ positive: "allowing destroy"
31
+ negative: "not allowing destroy"
32
+ accept:
33
+ positive: "accepting {{sentence}}"
34
+ reject:
35
+ positive: "rejecting {{sentence}}"
36
+
37
+ allow_values_for:
38
+ description: "allow {{in}} as values for {{attributes}}"
39
+ expectations:
40
40
  is_valid: "{{subject_name}} to be valid when {{attribute}} is set to {{value}}"
41
-
42
- allow_mass_assignment_of:
43
- description: "allow mass assignment of {{attributes}}"
44
- expectations:
45
- allows: "{{subject_name}} to allow mass assignment ({{subject_name}} is protecting {{protected_attributes}})"
46
- is_protected: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} is protecting {{attribute}})"
41
+
42
+ allow_mass_assignment_of:
43
+ description: "allow mass assignment of {{attributes}}"
44
+ expectations:
45
+ allows: "{{subject_name}} to allow mass assignment ({{subject_name}} is protecting {{protected_attributes}})"
46
+ is_protected: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} is protecting {{attribute}})"
47
47
  is_accessible: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} has not made {{attribute}} accessible)"
48
- negative_expectations:
49
- allows: "{{subject_name}} to allow mass assignment ({{subject_name}} made {{accessible_attributes}} accessible)"
50
- is_protected: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} is not protecting {{attribute}})"
51
- is_accessible: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} has made {{attribute}} accessible)"
52
-
53
- association:
54
- belongs_to: belong to
55
- has_many: have many
56
- has_and_belongs_to_many: have and belong to many
57
- has_one: have one
58
- description: "{{macro}} {{associations}}"
59
- expectations:
60
- association_exists: "{{subject_name}} records {{macro}} {{association}}, but the association does not exist"
61
- macro_matches: "{{subject_name}} records {{macro}} {{association}}, got {{subject_name}} records {{actual_macro}} {{association}}"
62
- through_exists: "{{subject_name}} records {{macro}} {{association}} through {{through}}, through association does not exist"
63
- source_exists: "{{subject_name}} records {{macro}} {{association}} through {{through}}, source association does not exist"
64
- klass_exists: "{{subject_name}} records {{macro}} {{association}}, but the association class does not exist"
65
- join_table_exists: "join table {{join_table}} to exist, but does not"
66
- foreign_key_exists: "foreign key {{foreign_key}} to exist on {{foreign_key_table}}, but does not"
67
- polymorphic_exists: "{{subject_table}} to have {{polymorphic_column}} as column, but does not"
68
- counter_cache_exists: "{{reflection_table}} to have {{counter_cache_column}} as column, but does not"
69
- options_match: "{{subject_name}} records {{macro}} {{association}} with options {{options}}, got {{actual}}"
70
- optionals:
71
- through:
72
- positive: "through {{value}}"
73
- source:
74
- positive: "with source {{inspect}}"
75
- source_type:
76
- positive: "with source type {{inspect}}"
77
- class_name:
78
- positive: "with class name {{inspect}}"
79
- foreign_key:
80
- positive: "with foreign key {{inspect}}"
81
- dependent:
82
- positive: "with dependent {{inspect}}"
83
- join_table:
84
- positive: "with join table {{inspect}}"
85
- uniq:
86
- positive: "with unique records"
87
- negative: "without unique records"
88
- readonly:
89
- positive: "with readonly records"
90
- negative: "without readonly records"
91
- validate:
92
- positive: "validating associated records"
93
- negative: "not validating associated records"
94
- autosave:
95
- positive: "autosaving associated records"
96
- negative: "not autosaving associated records"
97
- as:
98
- positive: "through the polymorphic interface {{inspect}}"
99
- counter_cache:
100
- positive: "with counter cache {{inspect}}"
101
- negative: "without counter cache"
102
- select:
103
- positive: "selecting {{inspect}}"
104
- conditions:
105
- positive: "with conditions {{inspect}}"
106
- include:
107
- positive: "including {{inspect}}"
108
- group:
109
- positive: "grouping by {{inspect}}"
110
- having:
111
- positive: "having {{inspect}}"
112
- order:
113
- positive: "with order {{inspect}}"
114
- limit:
115
- positive: "with limit {{inspect}}"
116
- offset:
117
- positive: "with offset {{inspect}}"
118
-
119
- have_column:
120
- description: "have column(s) named {{columns}}"
121
- expectations:
122
- column_exists: "{{subject_name}} to have column named {{column}}"
123
- options_match: "{{subject_name}} to have column {{column}} with options {{options}}, got {{actual}}"
124
- optionals:
125
- type:
126
- positive: "with type {{inspect}}"
127
- null:
128
- positive: "allowing null values"
129
- negative: "not allowing null values"
130
- default:
131
- positive: "with default value {{inspect}}"
132
- negative: "with default value {{inspect}}"
133
- limit:
134
- positive: "with limit {{inspect}}"
135
-
136
- have_default_scope:
137
- description: "have a default scope with {{options}}"
138
- expectations:
139
- options_match: "default scope with {{options}}, got {{actual}}"
140
-
141
- have_index:
142
- description: "have index for column(s) {{columns}}"
143
- expectations:
144
- index_exists: "index {{column}} to exist on table {{table_name}}"
145
- is_unique: "index on {{column}} with unique equals to {{unique}}, got {{actual}}"
146
- optionals:
147
- unique:
148
- positive: "with unique values"
149
- negative: "with non unique values"
150
- table_name:
151
- positive: "on table {{value}}"
152
-
153
- have_readonly_attributes:
154
- description: "make {{attributes}} read-only"
155
- expectations:
156
- is_readonly: "{{subject_name}} to make {{attribute}} read-only, got {{actual}}"
157
-
158
- have_scope:
159
- description: "have to scope itself to {{options}} when {{scope_name}} is called"
160
- expectations:
161
- is_scope: "{{scope_name}} when called on {{subject_name}} return an instance of ActiveRecord::NamedScope::Scope"
162
- options_match: "{{scope_name}} when called on {{subject_name}} scope to {{options}}, got {{actual}}"
163
- optionals:
164
- with:
165
- positive: "with {{inspect}} as argument"
166
-
167
- validate_acceptance_of:
168
- description: "require {{attributes}} to be accepted"
169
- expectations:
170
- requires_acceptance: "{{subject_name}} to be invalid if {{attribute}} is not accepted"
171
- accept_is_valid: "{{subject_name}} to be valid when {{attribute}} is accepted with value {{accept}}"
172
- optionals:
173
- accept:
174
- positive: "with value {{inspect}}"
175
-
176
- validate_associated:
177
- description: "require associated {{associations}} to be valid"
178
- expectations:
179
- is_valid: "{{subject_name}} to be invalid when {{association}} is invalid"
180
-
181
- validate_confirmation_of:
182
- description: "require {{attributes}} to be confirmed"
183
- expectations:
184
- responds_to_confirmation: "{{subject_name}} instance responds to {{attribute}}_confirmation"
185
- confirms: "{{subject_name}} to be valid only when {{attribute}} is confirmed"
186
-
187
- validate_exclusion_of:
188
- description: "ensure exclusion of {{attributes}} in {{in}}"
189
- expectations:
190
- is_valid: "{{subject_name}} to be valid when {{attribute}} is set to {{value}}"
191
- is_invalid: "{{subject_name}} to be invalid when {{attribute}} is set to {{value}}"
192
-
193
- validate_inclusion_of:
194
- description: "ensure inclusion of {{attributes}} in {{in}}"
195
- expectations:
196
- is_valid: "{{subject_name}} to be valid when {{attribute}} is set to {{value}}"
197
- is_invalid: "{{subject_name}} to be invalid when {{attribute}} is set to {{value}}"
198
-
199
- validate_length_of:
200
- description: "ensure length of {{attributes}}"
201
- expectations:
202
- less_than_min_length: "{{subject_name}} to be invalid when {{attribute}} length is less than {{minimum}} characters"
203
- exactly_min_length: "{{subject_name}} to be valid when {{attribute}} length is {{minimum}} characters"
204
- more_than_max_length: "{{subject_name}} to be invalid when {{attribute}} length is more than {{maximum}} characters"
205
- exactly_max_length: "{{subject_name}} to be valid when {{attribute}} length is {{maximum}} characters"
206
- optionals:
207
- within:
208
- positive: "is within {{inspect}} characters"
209
- maximum:
210
- positive: "is maximum {{inspect}} characters"
211
- minimum:
212
- positive: "is minimum {{inspect}} characters"
213
- is:
214
- positive: "is equal to {{inspect}} characters"
215
- with_kind_of:
216
- positive: "with kind of {{value}}"
217
-
218
- validate_numericality_of:
219
- description: "ensure numericality of {{attributes}}"
220
- expectations:
221
- only_numeric_values: "{{subject_name}} to allow only numeric values for {{attribute}}"
222
- only_integer: "{{subject_name}} to {{not}}allow only integer values for {{attribute}}"
223
- only_even: "{{subject_name}} to allow only even values for {{attribute}}"
224
- only_odd: "{{subject_name}} to allow only odd values for {{attribute}}"
225
- equals_to: "{{subject_name}} to be valid only when {{attribute}} is equal to {{count}}"
226
- more_than_maximum: "{{subject_name}} to be invalid when {{attribute}} is greater than {{count}}"
227
- less_than_minimum: "{{subject_name}} to be invalid when {{attribute}} is less than {{count}}"
228
- optionals:
229
- only_integer:
230
- positive: "allowing only integer values"
231
- odd:
232
- positive: "allowing only odd values"
233
- even:
234
- positive: "allowing only even values"
235
- equal_to:
236
- positive: "is equal to {{inspect}}"
237
- less_than:
238
- positive: "is less than {{inspect}}"
239
- greater_than:
240
- positive: "is greater than {{inspect}}"
241
- less_than_or_equal_to:
242
- positive: "is less than or equal to {{inspect}}"
243
- greater_than_or_equal_to:
244
- positive: "is greater than or equal to {{inspect}}"
245
-
246
- validate_presence_of:
247
- description: "require {{attributes}} to be set"
248
- expectations:
249
- allow_nil: "{{subject_name}} to require {{attribute}} to be set"
250
-
251
- validate_uniqueness_of:
252
- description: "require unique values for {{attributes}}"
253
- expectations:
254
- responds_to_scope: "{{subject_name}} instance responds to {{method}}"
255
- is_unique: "{{subject_name}} to require unique values for {{attribute}}"
256
- case_sensitive: "{{subject_name}} to {{not}}be case sensitive on {{attribute}} validation"
257
- valid_with_new_scope: "{{subject_name}} to be valid when {{attribute}} scope ({{method}}) change"
258
- optionals:
259
- scope:
260
- positive: "scoped to {{sentence}}"
261
- case_sensitive:
262
- positive: "case sensitive"
263
- negative: "case insensitive"
264
-
48
+ negative_expectations:
49
+ allows: "{{subject_name}} to allow mass assignment ({{subject_name}} made {{accessible_attributes}} accessible)"
50
+ is_protected: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} is not protecting {{attribute}})"
51
+ is_accessible: "{{subject_name}} to allow mass assignment of {{attribute}} ({{subject_name}} has made {{attribute}} accessible)"
52
+
53
+ association:
54
+ belongs_to: belong to
55
+ has_many: have many
56
+ has_and_belongs_to_many: have and belong to many
57
+ has_one: have one
58
+ description: "{{macro}} {{associations}}"
59
+ expectations:
60
+ association_exists: "{{subject_name}} records {{macro}} {{association}}, but the association does not exist"
61
+ macro_matches: "{{subject_name}} records {{macro}} {{association}}, got {{subject_name}} records {{actual_macro}} {{association}}"
62
+ through_exists: "{{subject_name}} records {{macro}} {{association}} through {{through}}, through association does not exist"
63
+ source_exists: "{{subject_name}} records {{macro}} {{association}} through {{through}}, source association does not exist"
64
+ klass_exists: "{{subject_name}} records {{macro}} {{association}}, but the association class does not exist"
65
+ join_table_exists: "join table {{join_table}} to exist, but does not"
66
+ foreign_key_exists: "foreign key {{foreign_key}} to exist on {{foreign_key_table}}, but does not"
67
+ polymorphic_exists: "{{subject_table}} to have {{polymorphic_column}} as column, but does not"
68
+ counter_cache_exists: "{{reflection_table}} to have {{counter_cache_column}} as column, but does not"
69
+ options_match: "{{subject_name}} records {{macro}} {{association}} with options {{options}}, got {{actual}}"
70
+ optionals:
71
+ through:
72
+ positive: "through {{value}}"
73
+ source:
74
+ positive: "with source {{inspect}}"
75
+ source_type:
76
+ positive: "with source type {{inspect}}"
77
+ class_name:
78
+ positive: "with class name {{inspect}}"
79
+ foreign_key:
80
+ positive: "with foreign key {{inspect}}"
81
+ dependent:
82
+ positive: "with dependent {{inspect}}"
83
+ join_table:
84
+ positive: "with join table {{inspect}}"
85
+ uniq:
86
+ positive: "with unique records"
87
+ negative: "without unique records"
88
+ readonly:
89
+ positive: "with readonly records"
90
+ negative: "without readonly records"
91
+ validate:
92
+ positive: "validating associated records"
93
+ negative: "not validating associated records"
94
+ autosave:
95
+ positive: "autosaving associated records"
96
+ negative: "not autosaving associated records"
97
+ as:
98
+ positive: "through the polymorphic interface {{inspect}}"
99
+ counter_cache:
100
+ positive: "with counter cache {{inspect}}"
101
+ negative: "without counter cache"
102
+ select:
103
+ positive: "selecting {{inspect}}"
104
+ conditions:
105
+ positive: "with conditions {{inspect}}"
106
+ include:
107
+ positive: "including {{inspect}}"
108
+ group:
109
+ positive: "grouping by {{inspect}}"
110
+ having:
111
+ positive: "having {{inspect}}"
112
+ order:
113
+ positive: "with order {{inspect}}"
114
+ limit:
115
+ positive: "with limit {{inspect}}"
116
+ offset:
117
+ positive: "with offset {{inspect}}"
118
+
119
+ have_column:
120
+ description: "have column(s) named {{columns}}"
121
+ expectations:
122
+ column_exists: "{{subject_name}} to have column named {{column}}"
123
+ options_match: "{{subject_name}} to have column {{column}} with options {{options}}, got {{actual}}"
124
+ optionals:
125
+ type:
126
+ positive: "with type {{inspect}}"
127
+ null:
128
+ positive: "allowing null values"
129
+ negative: "not allowing null values"
130
+ default:
131
+ positive: "with default value {{inspect}}"
132
+ negative: "with default value {{inspect}}"
133
+ limit:
134
+ positive: "with limit {{inspect}}"
135
+
136
+ have_default_scope:
137
+ description: "have a default scope with {{options}}"
138
+ expectations:
139
+ options_match: "default scope with {{options}}, got {{actual}}"
140
+
141
+ have_index:
142
+ description: "have index for column(s) {{columns}}"
143
+ expectations:
144
+ index_exists: "index {{column}} to exist on table {{table_name}}"
145
+ is_unique: "index on {{column}} with unique equals to {{unique}}, got {{actual}}"
146
+ optionals:
147
+ unique:
148
+ positive: "with unique values"
149
+ negative: "with non unique values"
150
+ table_name:
151
+ positive: "on table {{value}}"
152
+
153
+ have_readonly_attributes:
154
+ description: "make {{attributes}} read-only"
155
+ expectations:
156
+ is_readonly: "{{subject_name}} to make {{attribute}} read-only, got {{actual}}"
157
+
158
+ have_scope:
159
+ description: "have to scope itself to {{options}} when {{scope_name}} is called"
160
+ expectations:
161
+ is_scope: "{{scope_name}} when called on {{subject_name}} return an instance of ActiveRecord::NamedScope::Scope"
162
+ options_match: "{{scope_name}} when called on {{subject_name}} scope to {{options}}, got {{actual}}"
163
+ optionals:
164
+ with:
165
+ positive: "with {{inspect}} as argument"
166
+
167
+ validate_acceptance_of:
168
+ description: "require {{attributes}} to be accepted"
169
+ expectations:
170
+ requires_acceptance: "{{subject_name}} to be invalid if {{attribute}} is not accepted"
171
+ accept_is_valid: "{{subject_name}} to be valid when {{attribute}} is accepted with value {{accept}}"
172
+ optionals:
173
+ accept:
174
+ positive: "with value {{inspect}}"
175
+
176
+ validate_associated:
177
+ description: "require associated {{associations}} to be valid"
178
+ expectations:
179
+ is_valid: "{{subject_name}} to be invalid when {{association}} is invalid"
180
+
181
+ validate_confirmation_of:
182
+ description: "require {{attributes}} to be confirmed"
183
+ expectations:
184
+ responds_to_confirmation: "{{subject_name}} instance responds to {{attribute}}_confirmation"
185
+ confirms: "{{subject_name}} to be valid only when {{attribute}} is confirmed"
186
+
187
+ validate_exclusion_of:
188
+ description: "ensure exclusion of {{attributes}} in {{in}}"
189
+ expectations:
190
+ is_valid: "{{subject_name}} to be valid when {{attribute}} is set to {{value}}"
191
+ is_invalid: "{{subject_name}} to be invalid when {{attribute}} is set to {{value}}"
192
+
193
+ validate_inclusion_of:
194
+ description: "ensure inclusion of {{attributes}} in {{in}}"
195
+ expectations:
196
+ is_valid: "{{subject_name}} to be valid when {{attribute}} is set to {{value}}"
197
+ is_invalid: "{{subject_name}} to be invalid when {{attribute}} is set to {{value}}"
198
+
199
+ validate_length_of:
200
+ description: "ensure length of {{attributes}}"
201
+ expectations:
202
+ less_than_min_length: "{{subject_name}} to be invalid when {{attribute}} length is less than {{minimum}} characters"
203
+ exactly_min_length: "{{subject_name}} to be valid when {{attribute}} length is {{minimum}} characters"
204
+ more_than_max_length: "{{subject_name}} to be invalid when {{attribute}} length is more than {{maximum}} characters"
205
+ exactly_max_length: "{{subject_name}} to be valid when {{attribute}} length is {{maximum}} characters"
206
+ optionals:
207
+ within:
208
+ positive: "is within {{inspect}} characters"
209
+ maximum:
210
+ positive: "is maximum {{inspect}} characters"
211
+ minimum:
212
+ positive: "is minimum {{inspect}} characters"
213
+ is:
214
+ positive: "is equal to {{inspect}} characters"
215
+ with_kind_of:
216
+ positive: "with kind of {{value}}"
217
+
218
+ validate_numericality_of:
219
+ description: "ensure numericality of {{attributes}}"
220
+ expectations:
221
+ only_numeric_values: "{{subject_name}} to allow only numeric values for {{attribute}}"
222
+ only_integer: "{{subject_name}} to {{not}}allow only integer values for {{attribute}}"
223
+ only_even: "{{subject_name}} to allow only even values for {{attribute}}"
224
+ only_odd: "{{subject_name}} to allow only odd values for {{attribute}}"
225
+ equals_to: "{{subject_name}} to be valid only when {{attribute}} is equal to {{count}}"
226
+ more_than_maximum: "{{subject_name}} to be invalid when {{attribute}} is greater than {{count}}"
227
+ less_than_minimum: "{{subject_name}} to be invalid when {{attribute}} is less than {{count}}"
228
+ optionals:
229
+ only_integer:
230
+ positive: "allowing only integer values"
231
+ odd:
232
+ positive: "allowing only odd values"
233
+ even:
234
+ positive: "allowing only even values"
235
+ equal_to:
236
+ positive: "is equal to {{inspect}}"
237
+ less_than:
238
+ positive: "is less than {{inspect}}"
239
+ greater_than:
240
+ positive: "is greater than {{inspect}}"
241
+ less_than_or_equal_to:
242
+ positive: "is less than or equal to {{inspect}}"
243
+ greater_than_or_equal_to:
244
+ positive: "is greater than or equal to {{inspect}}"
245
+
246
+ validate_presence_of:
247
+ description: "require {{attributes}} to be set"
248
+ expectations:
249
+ allow_nil: "{{subject_name}} to require {{attribute}} to be set"
250
+
251
+ validate_uniqueness_of:
252
+ description: "require unique values for {{attributes}}"
253
+ expectations:
254
+ responds_to_scope: "{{subject_name}} instance responds to {{method}}"
255
+ is_unique: "{{subject_name}} to require unique values for {{attribute}}"
256
+ case_sensitive: "{{subject_name}} to {{not}}be case sensitive on {{attribute}} validation"
257
+ valid_with_new_scope: "{{subject_name}} to be valid when {{attribute}} scope ({{method}}) change"
258
+ optionals:
259
+ scope:
260
+ positive: "scoped to {{sentence}}"
261
+ case_sensitive:
262
+ positive: "case sensitive"
263
+ negative: "case insensitive"
264
+