shoulda-matchers 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -3
- data/CONTRIBUTING.md +60 -28
- data/Gemfile +1 -0
- data/Gemfile.lock +15 -12
- data/NEWS.md +111 -0
- data/README.md +94 -6
- data/Rakefile +10 -8
- data/custom_plan.rb +88 -0
- data/gemfiles/4.0.0.gemfile +1 -0
- data/gemfiles/4.0.0.gemfile.lock +21 -18
- data/gemfiles/4.0.1.gemfile +1 -0
- data/gemfiles/4.0.1.gemfile.lock +21 -18
- data/gemfiles/4.1.gemfile +1 -0
- data/gemfiles/4.1.gemfile.lock +21 -18
- data/gemfiles/4.2.gemfile +1 -0
- data/gemfiles/4.2.gemfile.lock +24 -21
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +6 -11
- data/lib/shoulda/matchers/active_model.rb +10 -1
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +258 -180
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb +45 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb +23 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +236 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb +62 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb +40 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb +48 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/successful_check.rb +14 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/successful_setting.rb +14 -0
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +34 -14
- data/lib/shoulda/matchers/active_model/helpers.rb +9 -17
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +13 -6
- data/lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb +13 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +19 -35
- data/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb +13 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb +12 -2
- data/lib/shoulda/matchers/active_model/qualifiers.rb +12 -0
- data/lib/shoulda/matchers/active_model/qualifiers/ignore_interference_by_writer.rb +101 -0
- data/lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb +21 -0
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +30 -32
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +5 -8
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +22 -22
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +27 -16
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +58 -15
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +22 -12
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +165 -87
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +7 -9
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +111 -49
- data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +60 -0
- data/lib/shoulda/matchers/active_model/validator.rb +71 -52
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +19 -5
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +450 -124
- data/lib/shoulda/matchers/util.rb +43 -0
- data/lib/shoulda/matchers/util/word_wrap.rb +59 -31
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/update_gem_in_all_appraisals +1 -1
- data/script/update_gems_in_all_appraisals +1 -1
- data/spec/acceptance/multiple_libraries_integration_spec.rb +5 -2
- data/spec/acceptance/rails_integration_spec.rb +6 -2
- data/spec/spec_helper.rb +1 -3
- data/spec/support/acceptance/helpers/step_helpers.rb +4 -1
- data/spec/support/tests/current_bundle.rb +21 -7
- data/spec/support/unit/active_record/create_table.rb +54 -0
- data/spec/support/unit/attribute.rb +47 -0
- data/spec/support/unit/capture.rb +6 -0
- data/spec/support/unit/change_value.rb +111 -0
- data/spec/support/unit/create_model_arguments/basic.rb +135 -0
- data/spec/support/unit/create_model_arguments/has_many.rb +15 -0
- data/spec/support/unit/create_model_arguments/uniqueness_matcher.rb +74 -0
- data/spec/support/unit/helpers/active_record_versions.rb +1 -1
- data/spec/support/unit/helpers/class_builder.rb +61 -47
- data/spec/support/unit/helpers/database_helpers.rb +5 -3
- data/spec/support/unit/helpers/model_builder.rb +77 -97
- data/spec/support/unit/helpers/validation_matcher_scenario_helpers.rb +44 -0
- data/spec/support/unit/load_environment.rb +12 -0
- data/spec/support/unit/matchers/fail_with_message_including_matcher.rb +2 -2
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +12 -1
- data/spec/support/unit/model_creation_strategies/active_model.rb +111 -0
- data/spec/support/unit/model_creation_strategies/active_record.rb +77 -0
- data/spec/support/unit/model_creators.rb +19 -0
- data/spec/support/unit/model_creators/active_model.rb +39 -0
- data/spec/support/unit/model_creators/active_record.rb +43 -0
- data/spec/support/unit/model_creators/active_record/has_and_belongs_to_many.rb +95 -0
- data/spec/support/unit/model_creators/active_record/has_many.rb +67 -0
- data/spec/support/unit/model_creators/active_record/uniqueness_matcher.rb +42 -0
- data/spec/support/unit/model_creators/basic.rb +97 -0
- data/spec/support/unit/rails_application.rb +1 -1
- data/spec/support/unit/record_validating_confirmation_builder.rb +3 -7
- data/spec/support/unit/shared_examples/ignoring_interference_by_writer.rb +79 -0
- data/spec/support/unit/validation_matcher_scenario.rb +62 -0
- data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +4 -0
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +575 -140
- data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +115 -15
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +42 -4
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +92 -6
- data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +122 -10
- data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +306 -58
- data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +122 -3
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +805 -131
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +196 -29
- data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +82 -40
- data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +600 -101
- data/spec/unit/shoulda/matchers/util/word_wrap_spec.rb +88 -33
- data/spec/unit_spec_helper.rb +10 -22
- data/zeus.json +11 -0
- metadata +64 -23
- data/lib/shoulda/matchers/active_model/strict_validator.rb +0 -51
- data/spec/support/unit/shared_examples/numerical_type_submatcher.rb +0 -15
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +0 -288
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/even_number_matcher_spec.rb +0 -100
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher_spec.rb +0 -100
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher_spec.rb +0 -100
@@ -3,40 +3,51 @@ require 'shoulda/matchers/util/word_wrap'
|
|
3
3
|
|
4
4
|
describe Shoulda::Matchers, ".word_wrap" do
|
5
5
|
it "can wrap a simple paragraph" do
|
6
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE.
|
6
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
7
7
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat
|
8
8
|
MESSAGE
|
9
9
|
|
10
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
10
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
11
11
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus,
|
12
12
|
ipsum sit amet efficitur feugiat
|
13
13
|
MESSAGE
|
14
14
|
end
|
15
15
|
|
16
16
|
it "does not split words up when wrapping" do
|
17
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE.
|
17
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
18
18
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lusciousness, ipsum sit amet efficitur feugiat
|
19
19
|
MESSAGE
|
20
20
|
|
21
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
21
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
22
22
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
23
23
|
lusciousness, ipsum sit amet efficitur feugiat
|
24
24
|
MESSAGE
|
25
25
|
end
|
26
26
|
|
27
27
|
it "considers punctuation as part of a word" do
|
28
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE.
|
28
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
29
29
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luscious, ipsum sit amet efficitur feugiat
|
30
30
|
MESSAGE
|
31
31
|
|
32
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
32
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
33
33
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
34
34
|
luscious, ipsum sit amet efficitur feugiat
|
35
35
|
MESSAGE
|
36
36
|
end
|
37
37
|
|
38
|
+
it "does not break at the maximum line length, but afterward" do
|
39
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
40
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luscius, ipsum sit amet efficitur feugiat
|
41
|
+
MESSAGE
|
42
|
+
|
43
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
44
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luscius,
|
45
|
+
ipsum sit amet efficitur feugiat
|
46
|
+
MESSAGE
|
47
|
+
end
|
48
|
+
|
38
49
|
it "re-wraps entire paragraphs" do
|
39
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
50
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
40
51
|
Lorem ipsum dolor sit amet,
|
41
52
|
consectetur adipiscing elit.
|
42
53
|
Aenean luctus,
|
@@ -44,7 +55,7 @@ ipsum sit amet efficitur feugiat,
|
|
44
55
|
dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
45
56
|
MESSAGE
|
46
57
|
|
47
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
58
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
48
59
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus,
|
49
60
|
ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed
|
50
61
|
posuere diam ex ut velit.
|
@@ -52,13 +63,13 @@ posuere diam ex ut velit.
|
|
52
63
|
end
|
53
64
|
|
54
65
|
it "can wrap multiple paragraphs" do
|
55
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE.
|
66
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
56
67
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
57
68
|
|
58
69
|
Etiam ultrices cursus ligula eget feugiat. Vestibulum eget tincidunt risus, non faucibus sem.
|
59
70
|
MESSAGE
|
60
71
|
|
61
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
72
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
62
73
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus,
|
63
74
|
ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed
|
64
75
|
posuere diam ex ut velit.
|
@@ -69,21 +80,21 @@ risus, non faucibus sem.
|
|
69
80
|
end
|
70
81
|
|
71
82
|
it "can wrap a bulleted list" do
|
72
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
83
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
73
84
|
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
74
85
|
* And the beat goes on.
|
75
86
|
MESSAGE
|
76
87
|
|
77
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
88
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
78
89
|
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
79
|
-
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla
|
80
|
-
|
90
|
+
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat,
|
91
|
+
sed posuere diam ex ut velit.
|
81
92
|
* And the beat goes on.
|
82
93
|
MESSAGE
|
83
94
|
end
|
84
95
|
|
85
96
|
it "re-wraps bulleted lists" do
|
86
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
97
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
87
98
|
* Lorem ipsum dolor sit amet,
|
88
99
|
consectetur adipiscing elit.
|
89
100
|
Aenean luctus,
|
@@ -93,21 +104,21 @@ risus, non faucibus sem.
|
|
93
104
|
* And the beat goes on.
|
94
105
|
MESSAGE
|
95
106
|
|
96
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
107
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
97
108
|
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
98
|
-
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla
|
99
|
-
|
109
|
+
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat,
|
110
|
+
sed posuere diam ex ut velit.
|
100
111
|
* And the beat goes on.
|
101
112
|
MESSAGE
|
102
113
|
end
|
103
114
|
|
104
115
|
it "can wrap a numbered list" do
|
105
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
116
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
106
117
|
1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
107
118
|
2. And the beat goes on.
|
108
119
|
MESSAGE
|
109
120
|
|
110
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
121
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
111
122
|
1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
112
123
|
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla
|
113
124
|
erat, sed posuere diam ex ut velit.
|
@@ -116,7 +127,7 @@ risus, non faucibus sem.
|
|
116
127
|
end
|
117
128
|
|
118
129
|
it "re-wraps numbered lists" do
|
119
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
130
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
120
131
|
1. Lorem ipsum dolor sit amet,
|
121
132
|
consectetur adipiscing elit.
|
122
133
|
Aenean luctus,
|
@@ -126,7 +137,7 @@ risus, non faucibus sem.
|
|
126
137
|
2. And the beat goes on.
|
127
138
|
MESSAGE
|
128
139
|
|
129
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
140
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
130
141
|
1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
131
142
|
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla
|
132
143
|
erat, sed posuere diam ex ut velit.
|
@@ -135,12 +146,12 @@ risus, non faucibus sem.
|
|
135
146
|
end
|
136
147
|
|
137
148
|
it "can wrap a numbered list, using x) instead of x. as the leader" do
|
138
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
149
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
139
150
|
1) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
140
151
|
2) And the beat goes on.
|
141
152
|
MESSAGE
|
142
153
|
|
143
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
154
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
144
155
|
1) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
145
156
|
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla
|
146
157
|
erat, sed posuere diam ex ut velit.
|
@@ -149,7 +160,7 @@ risus, non faucibus sem.
|
|
149
160
|
end
|
150
161
|
|
151
162
|
it "re-wraps numbered lists using x) instead of x. as the leader" do
|
152
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
163
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
153
164
|
1) Lorem ipsum dolor sit amet,
|
154
165
|
consectetur adipiscing elit.
|
155
166
|
Aenean luctus,
|
@@ -159,7 +170,7 @@ risus, non faucibus sem.
|
|
159
170
|
2) And the beat goes on.
|
160
171
|
MESSAGE
|
161
172
|
|
162
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
173
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
163
174
|
1) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
164
175
|
luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla
|
165
176
|
erat, sed posuere diam ex ut velit.
|
@@ -168,7 +179,7 @@ risus, non faucibus sem.
|
|
168
179
|
end
|
169
180
|
|
170
181
|
it "doesn't mess with indented blocks" do
|
171
|
-
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
182
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
172
183
|
Some text is gonna go here.
|
173
184
|
|
174
185
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
@@ -176,7 +187,7 @@ Some text is gonna go here.
|
|
176
187
|
And now we return.
|
177
188
|
MESSAGE
|
178
189
|
|
179
|
-
expect(wrapped_message).to eq(<<-MESSAGE.
|
190
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
180
191
|
Some text is gonna go here.
|
181
192
|
|
182
193
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat, dolor mauris fringilla erat, sed posuere diam ex ut velit.
|
@@ -185,13 +196,57 @@ And now we return.
|
|
185
196
|
MESSAGE
|
186
197
|
end
|
187
198
|
|
188
|
-
|
189
|
-
|
199
|
+
context "given a string with a word longer than the max character limit" do
|
200
|
+
context "which stands on its own" do
|
201
|
+
it "simply returns the string" do
|
202
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
203
|
+
Foo bar baz and stuff and things Loremipsumdolorsitamet,consecteturadipiscingelit.Aeneanluctus,ipsumsitametefficiturfeugiat,
|
204
|
+
MESSAGE
|
205
|
+
|
206
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
207
|
+
Foo bar baz and stuff and things
|
190
208
|
Loremipsumdolorsitamet,consecteturadipiscingelit.Aeneanluctus,ipsumsitametefficiturfeugiat,
|
191
|
-
|
209
|
+
MESSAGE
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
context "which is preceded by some text" do
|
214
|
+
it "leaves the word on its own line" do
|
215
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
216
|
+
Foo bar baz and stuff and things Loremipsumdolorsitamet,consecteturadipiscingelit.Aeneanluctus,ipsumsitametefficiturfeugiat,
|
217
|
+
MESSAGE
|
218
|
+
|
219
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
220
|
+
Foo bar baz and stuff and things
|
221
|
+
Loremipsumdolorsitamet,consecteturadipiscingelit.Aeneanluctus,ipsumsitametefficiturfeugiat,
|
222
|
+
MESSAGE
|
223
|
+
end
|
224
|
+
end
|
192
225
|
|
193
|
-
|
226
|
+
context "which is followed by some text" do
|
227
|
+
it "leaves the word on its own line" do
|
228
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
229
|
+
Loremipsumdolorsitamet,consecteturadipiscingelit.Aeneanluctus,ipsumsitametefficiturfeugiat, and something goes after this
|
230
|
+
MESSAGE
|
231
|
+
|
232
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
194
233
|
Loremipsumdolorsitamet,consecteturadipiscingelit.Aeneanluctus,ipsumsitametefficiturfeugiat,
|
195
|
-
|
234
|
+
and something goes after this
|
235
|
+
MESSAGE
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
context "when :indent is given" do
|
241
|
+
it "uses the given indentation level when determining where to wrap lines" do
|
242
|
+
wrapped_message = described_class.word_wrap(<<-MESSAGE.strip, indent: 2)
|
243
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luctus, ipsum sit amet efficitur feugiat
|
244
|
+
MESSAGE
|
245
|
+
|
246
|
+
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
247
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
|
248
|
+
luctus, ipsum sit amet efficitur feugiat
|
249
|
+
MESSAGE
|
250
|
+
end
|
196
251
|
end
|
197
252
|
end
|
data/spec/unit_spec_helper.rb
CHANGED
@@ -1,17 +1,4 @@
|
|
1
|
-
require_relative 'support/
|
2
|
-
|
3
|
-
Tests::CurrentBundle.instance.assert_appraisal!
|
4
|
-
|
5
|
-
#---
|
6
|
-
|
7
|
-
require File.expand_path('../support/unit/rails_application', __FILE__)
|
8
|
-
|
9
|
-
$test_app = UnitTests::RailsApplication.new
|
10
|
-
$test_app.create
|
11
|
-
$test_app.load
|
12
|
-
|
13
|
-
ENV['BUNDLE_GEMFILE'] ||= app.gemfile_path
|
14
|
-
ENV['RAILS_ENV'] = 'test'
|
1
|
+
require_relative 'support/unit/load_environment'
|
15
2
|
|
16
3
|
require 'rspec/rails'
|
17
4
|
require 'shoulda-matchers'
|
@@ -23,14 +10,6 @@ Dir[ File.join(File.expand_path('../support/unit/**/*.rb', __FILE__)) ].sort.eac
|
|
23
10
|
end
|
24
11
|
|
25
12
|
RSpec.configure do |config|
|
26
|
-
if config.respond_to?(:infer_spec_type_from_file_location!)
|
27
|
-
config.infer_spec_type_from_file_location!
|
28
|
-
end
|
29
|
-
|
30
|
-
config.before(:all, type: :controller) do
|
31
|
-
self.class.controller(ApplicationController) { }
|
32
|
-
end
|
33
|
-
|
34
13
|
UnitTests::ActiveModelHelpers.configure_example_group(config)
|
35
14
|
UnitTests::ActiveModelVersions.configure_example_group(config)
|
36
15
|
UnitTests::ActiveResourceBuilder.configure_example_group(config)
|
@@ -44,8 +23,17 @@ RSpec.configure do |config|
|
|
44
23
|
UnitTests::ActiveModelVersions.configure_example_group(config)
|
45
24
|
UnitTests::DatabaseHelpers.configure_example_group(config)
|
46
25
|
UnitTests::ColumnTypeHelpers.configure_example_group(config)
|
26
|
+
UnitTests::ValidationMatcherScenarioHelpers.configure_example_group(config)
|
47
27
|
|
48
28
|
config.include UnitTests::Matchers
|
29
|
+
|
30
|
+
config.infer_spec_type_from_file_location!
|
31
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
32
|
+
config.alias_it_behaves_like_to(:it_supports, "it supports")
|
33
|
+
|
34
|
+
config.before(:all, type: :controller) do
|
35
|
+
self.class.controller(ApplicationController) { }
|
36
|
+
end
|
49
37
|
end
|
50
38
|
|
51
39
|
ActiveSupport::Deprecation.behavior = :stderr
|
data/zeus.json
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tammer Saleh
|
@@ -14,20 +14,20 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: activesupport
|
21
21
|
requirement: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
|
-
- -
|
23
|
+
- - '>='
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: 4.0.0
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 4.0.0
|
33
33
|
description: Making tests easy on the fingers and eyes
|
@@ -36,11 +36,11 @@ executables: []
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
39
|
+
- .gitignore
|
40
|
+
- .hound.yml
|
41
|
+
- .hound_config/ruby.yml
|
42
|
+
- .travis.yml
|
43
|
+
- .yardopts
|
44
44
|
- Appraisals
|
45
45
|
- CONTRIBUTING.md
|
46
46
|
- Gemfile
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- NEWS.md
|
50
50
|
- README.md
|
51
51
|
- Rakefile
|
52
|
+
- custom_plan.rb
|
52
53
|
- doc_config/gh-pages/index.html.erb
|
53
54
|
- doc_config/yard/setup.rb
|
54
55
|
- doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css
|
@@ -102,6 +103,14 @@ files:
|
|
102
103
|
- lib/shoulda/matchers/active_model.rb
|
103
104
|
- lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb
|
104
105
|
- lib/shoulda/matchers/active_model/allow_value_matcher.rb
|
106
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb
|
107
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb
|
108
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb
|
109
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb
|
110
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb
|
111
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb
|
112
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/successful_check.rb
|
113
|
+
- lib/shoulda/matchers/active_model/allow_value_matcher/successful_setting.rb
|
105
114
|
- lib/shoulda/matchers/active_model/disallow_value_matcher.rb
|
106
115
|
- lib/shoulda/matchers/active_model/errors.rb
|
107
116
|
- lib/shoulda/matchers/active_model/have_secure_password_matcher.rb
|
@@ -112,7 +121,9 @@ files:
|
|
112
121
|
- lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb
|
113
122
|
- lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
|
114
123
|
- lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb
|
115
|
-
- lib/shoulda/matchers/active_model/
|
124
|
+
- lib/shoulda/matchers/active_model/qualifiers.rb
|
125
|
+
- lib/shoulda/matchers/active_model/qualifiers/ignore_interference_by_writer.rb
|
126
|
+
- lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb
|
116
127
|
- lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb
|
117
128
|
- lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb
|
118
129
|
- lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb
|
@@ -122,6 +133,7 @@ files:
|
|
122
133
|
- lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb
|
123
134
|
- lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb
|
124
135
|
- lib/shoulda/matchers/active_model/validation_matcher.rb
|
136
|
+
- lib/shoulda/matchers/active_model/validation_matcher/build_description.rb
|
125
137
|
- lib/shoulda/matchers/active_model/validation_message_finder.rb
|
126
138
|
- lib/shoulda/matchers/active_model/validator.rb
|
127
139
|
- lib/shoulda/matchers/active_record.rb
|
@@ -233,7 +245,13 @@ files:
|
|
233
245
|
- spec/support/tests/database_configuration_registry.rb
|
234
246
|
- spec/support/tests/filesystem.rb
|
235
247
|
- spec/support/tests/version.rb
|
248
|
+
- spec/support/unit/active_record/create_table.rb
|
249
|
+
- spec/support/unit/attribute.rb
|
236
250
|
- spec/support/unit/capture.rb
|
251
|
+
- spec/support/unit/change_value.rb
|
252
|
+
- spec/support/unit/create_model_arguments/basic.rb
|
253
|
+
- spec/support/unit/create_model_arguments/has_many.rb
|
254
|
+
- spec/support/unit/create_model_arguments/uniqueness_matcher.rb
|
237
255
|
- spec/support/unit/helpers/active_model_helpers.rb
|
238
256
|
- spec/support/unit/helpers/active_model_versions.rb
|
239
257
|
- spec/support/unit/helpers/active_record_versions.rb
|
@@ -248,18 +266,30 @@ files:
|
|
248
266
|
- spec/support/unit/helpers/mailer_builder.rb
|
249
267
|
- spec/support/unit/helpers/model_builder.rb
|
250
268
|
- spec/support/unit/helpers/rails_versions.rb
|
269
|
+
- spec/support/unit/helpers/validation_matcher_scenario_helpers.rb
|
251
270
|
- spec/support/unit/i18n.rb
|
271
|
+
- spec/support/unit/load_environment.rb
|
252
272
|
- spec/support/unit/matchers/deprecate.rb
|
253
273
|
- spec/support/unit/matchers/fail_with_message_including_matcher.rb
|
254
274
|
- spec/support/unit/matchers/fail_with_message_matcher.rb
|
255
275
|
- spec/support/unit/matchers/print_warning_including.rb
|
276
|
+
- spec/support/unit/model_creation_strategies/active_model.rb
|
277
|
+
- spec/support/unit/model_creation_strategies/active_record.rb
|
278
|
+
- spec/support/unit/model_creators.rb
|
279
|
+
- spec/support/unit/model_creators/active_model.rb
|
280
|
+
- spec/support/unit/model_creators/active_record.rb
|
281
|
+
- spec/support/unit/model_creators/active_record/has_and_belongs_to_many.rb
|
282
|
+
- spec/support/unit/model_creators/active_record/has_many.rb
|
283
|
+
- spec/support/unit/model_creators/active_record/uniqueness_matcher.rb
|
284
|
+
- spec/support/unit/model_creators/basic.rb
|
256
285
|
- spec/support/unit/rails_application.rb
|
257
286
|
- spec/support/unit/record_builder_with_i18n_validation_message.rb
|
258
287
|
- spec/support/unit/record_validating_confirmation_builder.rb
|
259
288
|
- spec/support/unit/record_with_different_error_attribute_builder.rb
|
289
|
+
- spec/support/unit/shared_examples/ignoring_interference_by_writer.rb
|
260
290
|
- spec/support/unit/shared_examples/numerical_submatcher.rb
|
261
|
-
- spec/support/unit/shared_examples/numerical_type_submatcher.rb
|
262
291
|
- spec/support/unit/shared_examples/set_session_or_flash.rb
|
292
|
+
- spec/support/unit/validation_matcher_scenario.rb
|
263
293
|
- spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb
|
264
294
|
- spec/unit/shoulda/matchers/action_controller/filter_param_matcher_spec.rb
|
265
295
|
- spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb
|
@@ -278,10 +308,6 @@ files:
|
|
278
308
|
- spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb
|
279
309
|
- spec/unit/shoulda/matchers/active_model/have_secure_password_matcher_spec.rb
|
280
310
|
- spec/unit/shoulda/matchers/active_model/helpers_spec.rb
|
281
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb
|
282
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/even_number_matcher_spec.rb
|
283
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher_spec.rb
|
284
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher_spec.rb
|
285
311
|
- spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb
|
286
312
|
- spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb
|
287
313
|
- spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb
|
@@ -318,6 +344,7 @@ files:
|
|
318
344
|
- spec/warnings_spy/reader.rb
|
319
345
|
- spec/warnings_spy/reporter.rb
|
320
346
|
- tasks/documentation.rb
|
347
|
+
- zeus.json
|
321
348
|
homepage: http://thoughtbot.com/community/
|
322
349
|
licenses:
|
323
350
|
- MIT
|
@@ -328,17 +355,17 @@ require_paths:
|
|
328
355
|
- lib
|
329
356
|
required_ruby_version: !ruby/object:Gem::Requirement
|
330
357
|
requirements:
|
331
|
-
- -
|
358
|
+
- - '>='
|
332
359
|
- !ruby/object:Gem::Version
|
333
360
|
version: 2.0.0
|
334
361
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
335
362
|
requirements:
|
336
|
-
- -
|
363
|
+
- - '>='
|
337
364
|
- !ruby/object:Gem::Version
|
338
365
|
version: '0'
|
339
366
|
requirements: []
|
340
367
|
rubyforge_project:
|
341
|
-
rubygems_version: 2.
|
368
|
+
rubygems_version: 2.2.2
|
342
369
|
signing_key:
|
343
370
|
specification_version: 4
|
344
371
|
summary: Making tests easy on the fingers and eyes
|
@@ -379,7 +406,13 @@ test_files:
|
|
379
406
|
- spec/support/tests/database_configuration_registry.rb
|
380
407
|
- spec/support/tests/filesystem.rb
|
381
408
|
- spec/support/tests/version.rb
|
409
|
+
- spec/support/unit/active_record/create_table.rb
|
410
|
+
- spec/support/unit/attribute.rb
|
382
411
|
- spec/support/unit/capture.rb
|
412
|
+
- spec/support/unit/change_value.rb
|
413
|
+
- spec/support/unit/create_model_arguments/basic.rb
|
414
|
+
- spec/support/unit/create_model_arguments/has_many.rb
|
415
|
+
- spec/support/unit/create_model_arguments/uniqueness_matcher.rb
|
383
416
|
- spec/support/unit/helpers/active_model_helpers.rb
|
384
417
|
- spec/support/unit/helpers/active_model_versions.rb
|
385
418
|
- spec/support/unit/helpers/active_record_versions.rb
|
@@ -394,18 +427,30 @@ test_files:
|
|
394
427
|
- spec/support/unit/helpers/mailer_builder.rb
|
395
428
|
- spec/support/unit/helpers/model_builder.rb
|
396
429
|
- spec/support/unit/helpers/rails_versions.rb
|
430
|
+
- spec/support/unit/helpers/validation_matcher_scenario_helpers.rb
|
397
431
|
- spec/support/unit/i18n.rb
|
432
|
+
- spec/support/unit/load_environment.rb
|
398
433
|
- spec/support/unit/matchers/deprecate.rb
|
399
434
|
- spec/support/unit/matchers/fail_with_message_including_matcher.rb
|
400
435
|
- spec/support/unit/matchers/fail_with_message_matcher.rb
|
401
436
|
- spec/support/unit/matchers/print_warning_including.rb
|
437
|
+
- spec/support/unit/model_creation_strategies/active_model.rb
|
438
|
+
- spec/support/unit/model_creation_strategies/active_record.rb
|
439
|
+
- spec/support/unit/model_creators.rb
|
440
|
+
- spec/support/unit/model_creators/active_model.rb
|
441
|
+
- spec/support/unit/model_creators/active_record.rb
|
442
|
+
- spec/support/unit/model_creators/active_record/has_and_belongs_to_many.rb
|
443
|
+
- spec/support/unit/model_creators/active_record/has_many.rb
|
444
|
+
- spec/support/unit/model_creators/active_record/uniqueness_matcher.rb
|
445
|
+
- spec/support/unit/model_creators/basic.rb
|
402
446
|
- spec/support/unit/rails_application.rb
|
403
447
|
- spec/support/unit/record_builder_with_i18n_validation_message.rb
|
404
448
|
- spec/support/unit/record_validating_confirmation_builder.rb
|
405
449
|
- spec/support/unit/record_with_different_error_attribute_builder.rb
|
450
|
+
- spec/support/unit/shared_examples/ignoring_interference_by_writer.rb
|
406
451
|
- spec/support/unit/shared_examples/numerical_submatcher.rb
|
407
|
-
- spec/support/unit/shared_examples/numerical_type_submatcher.rb
|
408
452
|
- spec/support/unit/shared_examples/set_session_or_flash.rb
|
453
|
+
- spec/support/unit/validation_matcher_scenario.rb
|
409
454
|
- spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb
|
410
455
|
- spec/unit/shoulda/matchers/action_controller/filter_param_matcher_spec.rb
|
411
456
|
- spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb
|
@@ -424,10 +469,6 @@ test_files:
|
|
424
469
|
- spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb
|
425
470
|
- spec/unit/shoulda/matchers/active_model/have_secure_password_matcher_spec.rb
|
426
471
|
- spec/unit/shoulda/matchers/active_model/helpers_spec.rb
|
427
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb
|
428
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/even_number_matcher_spec.rb
|
429
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher_spec.rb
|
430
|
-
- spec/unit/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher_spec.rb
|
431
472
|
- spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb
|
432
473
|
- spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb
|
433
474
|
- spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb
|