shoulda-matchers 3.0.0.rc1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/Gemfile.lock +12 -41
- data/NEWS.md +118 -26
- data/README.md +34 -11
- data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -0
- data/doc_config/yard/templates/default/fulldoc/html/css/style.css +4 -0
- data/gemfiles/4.0.0.gemfile +2 -3
- data/gemfiles/4.0.0.gemfile.lock +47 -77
- data/gemfiles/4.0.1.gemfile +2 -3
- data/gemfiles/4.0.1.gemfile.lock +51 -79
- data/gemfiles/4.1.gemfile +2 -3
- data/gemfiles/4.1.gemfile.lock +73 -103
- data/gemfiles/4.2.gemfile +2 -3
- data/gemfiles/4.2.gemfile.lock +90 -124
- data/lib/shoulda/matchers.rb +1 -0
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +6 -8
- data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +1 -3
- data/lib/shoulda/matchers/action_controller/flash_store.rb +1 -8
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +140 -88
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +2 -5
- data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +5 -10
- data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +2 -4
- data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +1 -3
- data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +3 -5
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -7
- data/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +35 -9
- data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model.rb +57 -1
- data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +2 -5
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +162 -54
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +5 -2
- data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +1 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +24 -11
- data/lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb +4 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +0 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb +4 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb +2 -1
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +15 -13
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +4 -4
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +12 -14
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +10 -4
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +0 -3
- data/lib/shoulda/matchers/active_model/validator.rb +0 -8
- data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +4 -6
- data/lib/shoulda/matchers/active_record/association_matcher.rb +58 -43
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +1 -4
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +7 -7
- data/lib/shoulda/matchers/doublespeak/double.rb +10 -1
- data/lib/shoulda/matchers/doublespeak/double_collection.rb +13 -5
- data/lib/shoulda/matchers/doublespeak/method_call.rb +10 -1
- data/lib/shoulda/matchers/doublespeak/object_double.rb +2 -1
- data/lib/shoulda/matchers/doublespeak/world.rb +10 -0
- data/lib/shoulda/matchers/error.rb +4 -0
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +11 -10
- data/lib/shoulda/matchers/integrations/libraries.rb +1 -0
- data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/active_model.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/active_record.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -1
- data/lib/shoulda/matchers/integrations/libraries/routing.rb +27 -0
- data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/rspec.rb +2 -2
- data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
- data/lib/shoulda/matchers/routing.rb +10 -0
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/SUPPORTED_VERSIONS +1 -1
- data/spec/acceptance/independent_matchers_spec.rb +103 -42
- data/spec/doublespeak_spec_helper.rb +5 -1
- data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +34 -11
- data/spec/support/acceptance/helpers/rspec_helpers.rb +9 -13
- data/spec/support/acceptance/helpers/step_helpers.rb +13 -0
- data/spec/support/acceptance/matchers/have_output.rb +1 -1
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +1 -1
- data/spec/support/tests/command_runner.rb +5 -1
- data/spec/support/unit/helpers/active_record_versions.rb +0 -4
- data/spec/support/unit/shared_examples/set_session_or_flash.rb +8 -3
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +198 -39
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +269 -102
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +24 -0
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +118 -101
- data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -82
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +148 -121
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +20 -8
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +64 -183
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +14 -0
- data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +60 -0
- data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +23 -7
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +242 -0
- data/spec/unit_spec_helper.rb +4 -0
- data/tasks/documentation.rb +35 -0
- metadata +9 -8
- data/Guardfile +0 -5
- data/cucumber.yml +0 -1
- data/lib/shoulda/matchers/active_model/validator_with_captured_range_error.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d2511e64aa43fb787466f5a74f3988cbd42b3ff
|
4
|
+
data.tar.gz: d8ca90b46025cb37d4acd8111b1686902837257e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57e1a16493c88afaedc21664cd8725e140b4c5528941de796543a53086644d60c43aa980229bdbed70bd4340e415bf9e66c9825ac3bffdd74d2d8c281933363e
|
7
|
+
data.tar.gz: 7e8e7a91c8073833e9f1ee756201eebea1e67037c141d2d4602be1656407e192fea3c254177f8c05072625235c24d8d9f171d14bd1d4a5b9e7b6d086634e023e
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'appraisal', '~>
|
3
|
+
gem 'appraisal', '~> 2.0'
|
4
4
|
gem 'bundler', '~> 1.1'
|
5
5
|
gem 'pry', github: 'pry/pry'
|
6
6
|
gem 'pry-byebug'
|
@@ -12,5 +12,4 @@ gem 'rspec-expectations', '>= 3.2.0', '< 4'
|
|
12
12
|
gem 'yard'
|
13
13
|
gem 'redcarpet'
|
14
14
|
gem 'pygments.rb'
|
15
|
-
gem '
|
16
|
-
gem 'guard-yard'
|
15
|
+
gem 'fssm'
|
data/Gemfile.lock
CHANGED
@@ -10,42 +10,17 @@ GIT
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
appraisal (1.0
|
13
|
+
appraisal (2.1.0)
|
14
14
|
bundler
|
15
15
|
rake
|
16
16
|
thor (>= 0.14.0)
|
17
17
|
byebug (4.0.4)
|
18
18
|
columnize (= 0.9.0)
|
19
|
-
celluloid (0.16.0)
|
20
|
-
timers (~> 4.0.0)
|
21
19
|
coderay (1.1.0)
|
22
20
|
columnize (0.9.0)
|
23
21
|
diff-lcs (1.2.5)
|
24
|
-
|
25
|
-
formatador (0.2.5)
|
26
|
-
guard (2.12.5)
|
27
|
-
formatador (>= 0.2.4)
|
28
|
-
listen (~> 2.7)
|
29
|
-
lumberjack (~> 1.0)
|
30
|
-
nenv (~> 0.1)
|
31
|
-
notiffany (~> 0.0)
|
32
|
-
pry (>= 0.9.12)
|
33
|
-
shellany (~> 0.0)
|
34
|
-
thor (>= 0.18.1)
|
35
|
-
guard-yard (2.1.4)
|
36
|
-
guard (>= 1.1.0)
|
37
|
-
yard (>= 0.7.0)
|
38
|
-
hitimes (1.2.2)
|
39
|
-
listen (2.10.0)
|
40
|
-
celluloid (~> 0.16.0)
|
41
|
-
rb-fsevent (>= 0.9.3)
|
42
|
-
rb-inotify (>= 0.9)
|
43
|
-
lumberjack (1.0.9)
|
22
|
+
fssm (0.2.10)
|
44
23
|
method_source (0.8.2)
|
45
|
-
nenv (0.2.0)
|
46
|
-
notiffany (0.0.6)
|
47
|
-
nenv (~> 0.1)
|
48
|
-
shellany (~> 0.0)
|
49
24
|
posix-spawn (0.3.8)
|
50
25
|
pry-byebug (3.1.0)
|
51
26
|
byebug (~> 4.0)
|
@@ -54,21 +29,15 @@ GEM
|
|
54
29
|
posix-spawn (~> 0.3.6)
|
55
30
|
yajl-ruby (~> 1.1.0)
|
56
31
|
rake (10.4.2)
|
57
|
-
rb-fsevent (0.9.4)
|
58
|
-
rb-inotify (0.9.5)
|
59
|
-
ffi (>= 0.5.0)
|
60
32
|
redcarpet (3.0.0)
|
61
|
-
rspec-core (3.2
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-expectations (3.
|
33
|
+
rspec-core (3.3.2)
|
34
|
+
rspec-support (~> 3.3.0)
|
35
|
+
rspec-expectations (3.3.1)
|
64
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-support (3.
|
67
|
-
shellany (0.0.1)
|
37
|
+
rspec-support (~> 3.3.0)
|
38
|
+
rspec-support (3.3.0)
|
68
39
|
slop (3.6.0)
|
69
40
|
thor (0.19.1)
|
70
|
-
timers (4.0.1)
|
71
|
-
hitimes
|
72
41
|
yajl-ruby (1.1.0)
|
73
42
|
yard (0.8.7.3)
|
74
43
|
|
@@ -76,10 +45,9 @@ PLATFORMS
|
|
76
45
|
ruby
|
77
46
|
|
78
47
|
DEPENDENCIES
|
79
|
-
appraisal (~>
|
48
|
+
appraisal (~> 2.0)
|
80
49
|
bundler (~> 1.1)
|
81
|
-
|
82
|
-
guard-yard
|
50
|
+
fssm
|
83
51
|
pry!
|
84
52
|
pry-byebug
|
85
53
|
pygments.rb
|
@@ -88,3 +56,6 @@ DEPENDENCIES
|
|
88
56
|
rspec-core (>= 3.2.0, < 4)
|
89
57
|
rspec-expectations (>= 3.2.0, < 4)
|
90
58
|
yard
|
59
|
+
|
60
|
+
BUNDLED WITH
|
61
|
+
1.10.6
|
data/NEWS.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# 3.0.0
|
2
2
|
|
3
3
|
### Backward-incompatible changes
|
4
4
|
|
5
5
|
* We've dropped support for Rails 3.x, Ruby 1.9.2, and Ruby 1.9.3, and RSpec 2.
|
6
|
-
All of these
|
7
|
-
will stop working immediately, but we won't accept any pull requests to fix
|
8
|
-
any compatibility issues, so you're encouraged to upgrade.
|
9
|
-
([a4045a1], [b7fe87a])
|
6
|
+
All of these have been end-of-lifed. ([a4045a1], [b7fe87a], [32c0e62])
|
10
7
|
|
11
8
|
* The gem no longer detects the test framework you're using or mixes itself into
|
12
9
|
that framework automatically. [History][no-auto-integration-1] has
|
@@ -41,26 +38,117 @@
|
|
41
38
|
|
42
39
|
([1900071])
|
43
40
|
|
41
|
+
* Previously, under RSpec, all of the matchers were mixed into all of the
|
42
|
+
example groups. This created a problem because some gems, such as
|
43
|
+
[active_model_serializers-matchers], provide matchers that share the same
|
44
|
+
name as some of our own matchers. Now, matchers are only mixed into whichever
|
45
|
+
example group they belong to:
|
46
|
+
|
47
|
+
* ActiveModel and ActiveRecord matchers are available only in model example
|
48
|
+
groups.
|
49
|
+
* ActionController matchers are available only in controller example groups.
|
50
|
+
* The `route` matcher is available only in routing example groups.
|
51
|
+
|
52
|
+
([af98a23], [8cf449b])
|
53
|
+
|
44
54
|
* There are two changes to `allow_value`:
|
45
55
|
|
46
|
-
* The negative form of
|
56
|
+
* The negative form of `allow_value` has been changed so that instead of
|
47
57
|
asserting that any of the given values is an invalid value (allowing good
|
48
58
|
values to pass through), assert that *all* values are invalid values
|
49
59
|
(allowing good values not to pass through). This means that this test which
|
50
60
|
formerly passed will now fail:
|
51
61
|
|
52
|
-
|
62
|
+
``` ruby
|
63
|
+
expect(record).not_to allow_value('good value', *bad_values)
|
64
|
+
```
|
53
65
|
|
54
66
|
([19ce8a6])
|
55
67
|
|
56
|
-
*
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
* `allow_value` now raises a CouldNotSetAttributeError if in setting the
|
69
|
+
attribute, the value of the attribute from reading the attribute back is
|
70
|
+
different from the one used to set it.
|
71
|
+
|
72
|
+
This would happen if the writer method for that attribute has custom logic
|
73
|
+
to ignore certain incoming values or change them in any way. Here are three
|
74
|
+
examples we've seen:
|
75
|
+
|
76
|
+
* You're attempting to assert that an attribute should not allow nil, yet
|
77
|
+
the attribute's writer method contains a conditional to do nothing if
|
78
|
+
the attribute is set to nil:
|
79
|
+
|
80
|
+
``` ruby
|
81
|
+
class Foo
|
82
|
+
include ActiveModel::Model
|
83
|
+
|
84
|
+
attr_reader :bar
|
85
|
+
|
86
|
+
def bar=(value)
|
87
|
+
return if value.nil?
|
88
|
+
@bar = value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe Foo do
|
93
|
+
it do
|
94
|
+
foo = Foo.new
|
95
|
+
foo.bar = "baz"
|
96
|
+
# This will raise a CouldNotSetAttributeError since `foo.bar` is now "123"
|
97
|
+
expect(foo).not_to allow_value(nil).for(:bar)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
* You're attempting to assert that an numeric attribute should not allow a
|
103
|
+
string that contains non-numeric characters, yet the writer method for
|
104
|
+
that attribute strips out non-numeric characters:
|
105
|
+
|
106
|
+
``` ruby
|
107
|
+
class Foo
|
108
|
+
include ActiveModel::Model
|
109
|
+
|
110
|
+
attr_reader :bar
|
111
|
+
|
112
|
+
def bar=(value)
|
113
|
+
@bar = value.gsub(/\D+/, '')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe Foo do
|
118
|
+
it do
|
119
|
+
foo = Foo.new
|
120
|
+
# This will raise a CouldNotSetAttributeError since `foo.bar` is now "123"
|
121
|
+
expect(foo).not_to allow_value("abc123").for(:bar)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
```
|
125
|
+
|
126
|
+
* You're passing a value to `allow_value` that the model typecasts into
|
127
|
+
another value:
|
128
|
+
|
129
|
+
``` ruby
|
130
|
+
describe Foo do
|
131
|
+
# Assume that `attr` is a string
|
132
|
+
# This will raise a CouldNotSetAttributeError since `attr` typecasts `[]` to `"[]"`
|
133
|
+
it { should_not allow_value([]).for(:attr) }
|
134
|
+
end
|
135
|
+
```
|
136
|
+
|
137
|
+
With all of these failing examples, why are we making this change? We want
|
138
|
+
to guard you (as the developer) from writing a test that you think acts one
|
139
|
+
way but actually acts a different way, as this could lead to a confusing
|
140
|
+
false positive or negative.
|
141
|
+
|
142
|
+
If you understand the problem and wish to override this behavior so that
|
143
|
+
you do not get a CouldNotSetAttributeError, you can add the
|
144
|
+
`ignoring_interference_by_writer` qualifier like so. Note that this will not
|
145
|
+
always cause the test to pass.
|
146
|
+
|
147
|
+
``` ruby
|
148
|
+
it { should_not allow_value([]).for(:attr).ignoring_interference_by_writer }
|
149
|
+
```
|
150
|
+
|
151
|
+
([9d9dc4e])
|
64
152
|
|
65
153
|
* `validate_uniqueness_of` is now properly case-insensitive by default, to match
|
66
154
|
the default behavior of the validation itself. This is a backward-incompatible
|
@@ -89,6 +177,11 @@
|
|
89
177
|
* `set_session['key'].to(nil)` will no longer pass when the key in question
|
90
178
|
has not been set yet. ([535fe05])
|
91
179
|
|
180
|
+
* Change `set_flash` so that `set_flash[:foo].now` is no longer valid syntax.
|
181
|
+
You'll want to use `set_flash.now[:foo]` instead. This was changed in order to
|
182
|
+
more closely align with how `flash.now` works when used in a controller.
|
183
|
+
([#755], [#752])
|
184
|
+
|
92
185
|
* Change behavior of `validate_uniqueness_of` when the matcher is not
|
93
186
|
qualified with any scopes, but your validation is. Previously the following
|
94
187
|
test would pass when it now fails:
|
@@ -105,6 +198,7 @@
|
|
105
198
|
|
106
199
|
([6ac7b81])
|
107
200
|
|
201
|
+
[active_model_serializers-matchers]: https://github.com/adambarber/active_model_serializers-matchers
|
108
202
|
[no-auto-integration-1]: https://github.com/freerange/mocha/commit/049080c673ee3f76e76adc1e1a6122c7869f1648
|
109
203
|
[no-auto-integration-2]: https://github.com/rr/rr/issues/29
|
110
204
|
[1900071]: https://github.com/thoughtbot/shoulda-matchers/commit/190007155e0676aae84d08d8ed8eed3beebc3a06
|
@@ -116,8 +210,11 @@
|
|
116
210
|
[55c8d09]: https://github.com/thoughtbot/shoulda-matchers/commit/55c8d09bf2af886540924efa83c3b518d926a770
|
117
211
|
[801f2c7]: https://github.com/thoughtbot/shoulda-matchers/commit/801f2c7c1eab3b2053244485c9800f850959cfef
|
118
212
|
[535fe05]: https://github.com/thoughtbot/shoulda-matchers/commit/535fe05be8686fdafd8b22f2ed5c4192bd565d50
|
119
|
-
[eaaa2d8]: https://github.com/thoughtbot/shoulda-matchers/commit/eaaa2d83e5cd31a3ca0a1aaa65441ea1a4fffa49
|
120
213
|
[6ac7b81]: https://github.com/thoughtbot/shoulda-matchers/commit/6ac7b8158cfba3b518eb3da3c24345e4473b416f
|
214
|
+
[#755]: https://github.com/thoughtbot/shoulda-matchers/pull/755
|
215
|
+
[#752]: https://github.com/thoughtbot/shoulda-matchers/pull/752
|
216
|
+
[9d9dc4e]: https://github.com/thoughtbot/shoulda-matchers/commit/9d9dc4e6b9cf2c19df66a1b4ba432ad8d3e5dded
|
217
|
+
[32c0e62]: https://github.com/thoughtbot/shoulda-matchers/commit/32c0e62596b87e37a301f87bbe21cfcc77750552
|
121
218
|
|
122
219
|
### Bug fixes
|
123
220
|
|
@@ -157,6 +254,9 @@
|
|
157
254
|
* Fix failure message for `validate_numericality_of` as it sometimes didn't
|
158
255
|
provide the reason for failure. ([#699])
|
159
256
|
|
257
|
+
* Fix `shoulda/matchers/independent` so that it can be required
|
258
|
+
independently, without having to require all of the gem. ([#746], [e0a0200])
|
259
|
+
|
160
260
|
### Features
|
161
261
|
|
162
262
|
* Add `on` qualifier to `permit`. This allows you to make an assertion that
|
@@ -200,6 +300,8 @@
|
|
200
300
|
[#694]: https://github.com/thoughtbot/shoulda-matchers/pull/694
|
201
301
|
[#692]: https://github.com/thoughtbot/shoulda-matchers/pull/692
|
202
302
|
[#699]: https://github.com/thoughtbot/shoulda-matchers/pull/699
|
303
|
+
[#746]: https://github.com/thoughtbot/shoulda-matchers/pull/746
|
304
|
+
[e0a0200]: https://github.com/thoughtbot/shoulda-matchers/commit/e0a0200fe47157c161fb206043540804bdad664e
|
203
305
|
|
204
306
|
# 2.8.0
|
205
307
|
|
@@ -252,13 +354,6 @@
|
|
252
354
|
notation (e.g. `posts#show`), route parameters such as `id` do not need to be
|
253
355
|
specified as a string but may be specified as a number as well. ([#602])
|
254
356
|
|
255
|
-
* Fix `allow_value`, `validate_numericality_of` and `validate_inclusion_of` so
|
256
|
-
that they handle RangeErrors emitted from ActiveRecord 4.2. These exceptions
|
257
|
-
arise whenever we attempt to set an attribute using a value that lies outside
|
258
|
-
the range of the column (assuming the column is an integer). RangeError is now
|
259
|
-
treated specially, failing the test instead of bubbling up as an error.
|
260
|
-
([#634], [#637], [#642])
|
261
|
-
|
262
357
|
### Features
|
263
358
|
|
264
359
|
* Add ability to test `:primary_key` option on associations. ([#597])
|
@@ -304,9 +399,6 @@
|
|
304
399
|
[#622]: https://github.com/thoughtbot/shoulda-matchers/pull/622
|
305
400
|
[#627]: https://github.com/thoughtbot/shoulda-matchers/pull/627
|
306
401
|
[#631]: https://github.com/thoughtbot/shoulda-matchers/pull/631
|
307
|
-
[#634]: https://github.com/thoughtbot/shoulda-matchers/pull/634
|
308
|
-
[#637]: https://github.com/thoughtbot/shoulda-matchers/pull/637
|
309
|
-
[#642]: https://github.com/thoughtbot/shoulda-matchers/pull/642
|
310
402
|
|
311
403
|
# 2.7.0
|
312
404
|
|
data/README.md
CHANGED
@@ -16,9 +16,14 @@ interested in the README for 2.8.0 instead.][2.8.0-README]**
|
|
16
16
|
* **[allow_mass_assignment_of](lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb)**
|
17
17
|
tests usage of Rails 3's `attr_accessible` and `attr_protected` macros.
|
18
18
|
* **[allow_value](lib/shoulda/matchers/active_model/allow_value_matcher.rb)**
|
19
|
-
tests
|
19
|
+
tests that an attribute is valid or invalid if set to one or more values.
|
20
|
+
*(Aliased as #allow_values.)*
|
20
21
|
* **[have_secure_password](lib/shoulda/matchers/active_model/have_secure_password_matcher.rb)**
|
21
22
|
tests usage of `has_secure_password`.
|
23
|
+
* **[validate_absence_of](lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb)**
|
24
|
+
tests usage of `validates_absence_of`.
|
25
|
+
* **[validate_acceptance_of](lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb)**
|
26
|
+
tests usage of `validates_acceptance_of`.
|
22
27
|
* **[validate_confirmation_of](lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb)**
|
23
28
|
tests usage of `validates_confirmation_of`.
|
24
29
|
* **[validate_exclusion_of](lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb)**
|
@@ -80,14 +85,14 @@ interested in the README for 2.8.0 instead.][2.8.0-README]**
|
|
80
85
|
* **[set_flash](lib/shoulda/matchers/action_controller/set_flash_matcher.rb)**
|
81
86
|
makes assertions on the `flash` hash.
|
82
87
|
* **[use_after_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L79)**
|
83
|
-
tests that
|
84
|
-
as
|
88
|
+
tests that an `after_action` callback is defined in your controller. *(Aliased
|
89
|
+
as #use_after_filter.)*
|
85
90
|
* **[use_around_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L129)**
|
86
|
-
tests that
|
87
|
-
as
|
91
|
+
tests that an `around_action` callback is defined in your controller. *(Aliased
|
92
|
+
as #use_around_filter.)*
|
88
93
|
* **[use_before_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L54)**
|
89
|
-
tests that a `before_action` callback is defined in your controller. (Aliased
|
90
|
-
as
|
94
|
+
tests that a `before_action` callback is defined in your controller. *(Aliased
|
95
|
+
as #use_before_filter.)*
|
91
96
|
|
92
97
|
### Independent matchers
|
93
98
|
|
@@ -118,7 +123,19 @@ describe Person do
|
|
118
123
|
end
|
119
124
|
```
|
120
125
|
|
121
|
-
|
126
|
+
Note that in this README and throughout the documentation we're using the
|
127
|
+
`should` form of RSpec's one-liner syntax over `is_expected.to`. The `should`
|
128
|
+
form works regardless of how you've configured RSpec -- meaning you can still
|
129
|
+
use it even when using the `expect` syntax. But if you prefer to use
|
130
|
+
`is_expected.to`, you can do that too:
|
131
|
+
|
132
|
+
``` ruby
|
133
|
+
describe Person do
|
134
|
+
it { is_expected.to validate_presence_of(:name) }
|
135
|
+
end
|
136
|
+
```
|
137
|
+
|
138
|
+
### Minitest
|
122
139
|
|
123
140
|
Shoulda Matchers was originally a component of [Shoulda][shoulda], a gem that
|
124
141
|
also provides `should` and `context` syntax via
|
@@ -184,10 +201,11 @@ You can preview changes you make to the documentation locally by running
|
|
184
201
|
|
185
202
|
from this directory. Then, open `doc/index.html` in your browser.
|
186
203
|
|
187
|
-
If you want to
|
188
|
-
and over again, keep this command running in a separate terminal
|
204
|
+
If you want to be able to regenerate the docs as you work without having to run
|
205
|
+
`yard doc` over and over again, keep this command running in a separate terminal
|
206
|
+
session:
|
189
207
|
|
190
|
-
|
208
|
+
rake docs:autogenerate
|
191
209
|
|
192
210
|
## Contributing
|
193
211
|
|
@@ -198,6 +216,11 @@ If you'd like to contribute, please take a look at the
|
|
198
216
|
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
199
217
|
pull request.
|
200
218
|
|
219
|
+
## Compatibility
|
220
|
+
|
221
|
+
Shoulda Matchers is tested and supported against Rails 4.x, RSpec 3.x, Minitest
|
222
|
+
5, and Ruby 2.x.
|
223
|
+
|
201
224
|
## Versioning
|
202
225
|
|
203
226
|
Shoulda Matchers follows Semantic Versioning 2.0 as defined at
|
File without changes
|
data/gemfiles/4.0.0.gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "appraisal", "~>
|
5
|
+
gem "appraisal", "~> 2.0"
|
6
6
|
gem "bundler", "~> 1.1"
|
7
7
|
gem "pry", :github => "pry/pry"
|
8
8
|
gem "pry-byebug"
|
@@ -12,8 +12,7 @@ gem "rspec-expectations", ">= 3.2.0", "< 4"
|
|
12
12
|
gem "yard"
|
13
13
|
gem "redcarpet"
|
14
14
|
gem "pygments.rb"
|
15
|
-
gem "
|
16
|
-
gem "guard-yard"
|
15
|
+
gem "fssm"
|
17
16
|
gem "rspec-rails", ">= 3.2.0", "< 4"
|
18
17
|
gem "shoulda-context", "~> 1.2.0"
|
19
18
|
gem "sqlite3", :platform => :ruby
|