shoulda-matchers 3.1.3 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.hound/ruby.yml +336 -316
  3. data/.python-version +1 -0
  4. data/.rubocop.yml +3 -1
  5. data/.travis.yml +7 -6
  6. data/Appraisals +76 -44
  7. data/CONTRIBUTING.md +137 -66
  8. data/Gemfile +5 -5
  9. data/Gemfile.lock +30 -35
  10. data/MAINTAINING.md +250 -0
  11. data/MIT-LICENSE +1 -1
  12. data/NEWS.md +176 -4
  13. data/README.md +138 -200
  14. data/Rakefile +7 -0
  15. data/bin/setup +190 -0
  16. data/doc_config/yard/templates/default/fulldoc/html/css/global.css +4 -0
  17. data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -6
  18. data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -17
  19. data/doc_config/yard/templates/default/fulldoc/html/setup.rb +27 -0
  20. data/gemfiles/4.2.gemfile +21 -20
  21. data/gemfiles/4.2.gemfile.lock +143 -140
  22. data/gemfiles/5.0.gemfile +37 -0
  23. data/gemfiles/5.0.gemfile.lock +238 -0
  24. data/gemfiles/5.1.gemfile +38 -0
  25. data/gemfiles/5.1.gemfile.lock +254 -0
  26. data/gemfiles/5.2.gemfile +40 -0
  27. data/gemfiles/5.2.gemfile.lock +273 -0
  28. data/lib/shoulda/matchers/action_controller/callback_matcher.rb +18 -6
  29. data/lib/shoulda/matchers/action_controller/permit_matcher.rb +6 -1
  30. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
  31. data/lib/shoulda/matchers/action_controller/route_matcher.rb +87 -27
  32. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +1 -0
  33. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +0 -4
  34. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +5 -0
  35. data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +5 -0
  36. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +26 -11
  37. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +39 -4
  38. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +116 -47
  39. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +127 -38
  40. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +55 -37
  41. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +30 -1
  42. data/lib/shoulda/matchers/active_model/validation_matcher.rb +11 -4
  43. data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +11 -6
  44. data/lib/shoulda/matchers/active_record.rb +3 -0
  45. data/lib/shoulda/matchers/active_record/association_matcher.rb +172 -22
  46. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +1 -1
  47. data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +11 -6
  48. data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +46 -0
  49. data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +51 -0
  50. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +268 -38
  51. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
  52. data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +111 -0
  53. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +207 -79
  54. data/lib/shoulda/matchers/doublespeak/object_double.rb +5 -1
  55. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +100 -21
  56. data/lib/shoulda/matchers/rails_shim.rb +133 -52
  57. data/lib/shoulda/matchers/routing.rb +2 -2
  58. data/lib/shoulda/matchers/util.rb +23 -1
  59. data/lib/shoulda/matchers/util/word_wrap.rb +6 -2
  60. data/lib/shoulda/matchers/version.rb +1 -1
  61. data/script/install_gems_in_all_appraisals +3 -1
  62. data/script/run_all_tests +3 -1
  63. data/script/supported_ruby_versions +7 -0
  64. data/script/update_gem_in_all_appraisals +3 -1
  65. data/script/update_gems_in_all_appraisals +3 -1
  66. data/shoulda-matchers.gemspec +3 -3
  67. data/spec/acceptance/independent_matchers_spec.rb +2 -2
  68. data/spec/acceptance/multiple_libraries_integration_spec.rb +1 -1
  69. data/spec/acceptance/rails_integration_spec.rb +2 -2
  70. data/spec/spec_helper.rb +2 -3
  71. data/spec/support/acceptance/helpers.rb +2 -0
  72. data/spec/support/acceptance/helpers/command_helpers.rb +17 -4
  73. data/spec/support/acceptance/helpers/rails_migration_helpers.rb +21 -0
  74. data/spec/support/acceptance/helpers/step_helpers.rb +1 -1
  75. data/spec/support/tests/current_bundle.rb +3 -9
  76. data/spec/support/tests/filesystem.rb +2 -2
  77. data/spec/support/unit/attribute.rb +0 -2
  78. data/spec/support/unit/capture.rb +9 -3
  79. data/spec/support/unit/helpers/action_pack_versions.rb +22 -0
  80. data/spec/support/unit/helpers/active_model_versions.rb +4 -0
  81. data/spec/support/unit/helpers/active_record_versions.rb +22 -2
  82. data/spec/support/unit/helpers/active_resource_builder.rb +2 -2
  83. data/spec/support/unit/helpers/controller_builder.rb +1 -1
  84. data/spec/support/unit/helpers/message_helpers.rb +19 -0
  85. data/spec/support/unit/helpers/rails_versions.rb +14 -0
  86. data/spec/support/unit/matchers/fail_with_message_matcher.rb +7 -5
  87. data/spec/support/unit/matchers/print_warning_including.rb +21 -13
  88. data/spec/support/unit/model_creation_strategies/active_record.rb +1 -1
  89. data/spec/support/unit/model_creators/active_record.rb +0 -1
  90. data/spec/support/unit/model_creators/basic.rb +7 -2
  91. data/spec/support/unit/rails_application.rb +25 -0
  92. data/spec/support/unit/record_validating_confirmation_builder.rb +5 -2
  93. data/spec/support/unit/validation_matcher_scenario.rb +0 -2
  94. data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +18 -18
  95. data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +33 -5
  96. data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +1 -1
  97. data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +80 -78
  98. data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +7 -9
  99. data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +28 -4
  100. data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +19 -1
  101. data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +27 -4
  102. data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +62 -5
  103. data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +52 -18
  104. data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +51 -4
  105. data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +99 -71
  106. data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +41 -15
  107. data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +445 -15
  108. data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +615 -93
  109. data/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +169 -0
  110. data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +167 -97
  111. data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +2 -4
  112. data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +152 -19
  113. data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +258 -94
  114. data/spec/unit_spec_helper.rb +9 -1
  115. data/zeus.json +1 -1
  116. metadata +31 -16
  117. data/gemfiles/4.0.0.gemfile +0 -38
  118. data/gemfiles/4.0.0.gemfile.lock +0 -223
  119. data/gemfiles/4.0.1.gemfile +0 -38
  120. data/gemfiles/4.0.1.gemfile.lock +0 -225
  121. data/gemfiles/4.1.gemfile +0 -38
  122. data/gemfiles/4.1.gemfile.lock +0 -220
  123. data/script/SUPPORTED_VERSIONS +0 -1
data/README.md CHANGED
@@ -1,137 +1,50 @@
1
- # Shoulda Matchers [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge]
1
+ # Shoulda Matchers [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge] [![Hound][hound-badge]][hound]
2
2
 
3
- [![Join the chat at https://gitter.im/shoulda-matchers/Lobby](https://badges.gitter.im/shoulda-matchers/Lobby.svg)](https://gitter.im/shoulda-matchers/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+ [![shoulda-matchers][logo]][website]
4
4
 
5
5
  Shoulda Matchers provides RSpec- and Minitest-compatible one-liners that test
6
6
  common Rails functionality. These tests would otherwise be much longer, more
7
7
  complex, and error-prone.
8
8
 
9
- [View the official documentation for the latest version (3.1.1).][rubydocs]
9
+ * [Documentation](#documentation)
10
+ * [Compatibility](#compatibility)
11
+ * [Getting started](#getting-started)
12
+ * [RSpec](#rspec)
13
+ * [Availability of matchers in various example groups](#availability-of-matchers-in-various-example-groups)
14
+ * [<code>should</code> vs <code>is_expected.to</code>](#should-vs-is_expectedto)
15
+ * [Minitest](#minitest)
16
+ * [Matchers](#matchers)
17
+ * [ActiveModel matchers](#activemodel-matchers)
18
+ * [ActiveRecord matchers](#activerecord-matchers)
19
+ * [ActionController matchers](#actioncontroller-matchers)
20
+ * [Independent matchers](#independent-matchers)
21
+ * [Contributing](#contributing)
22
+ * [Versioning](#versioning)
23
+ * [License](#license)
24
+ * [About thoughtbot](#about-thoughtbot)
25
+
26
+ ## Documentation
27
+
28
+ [View the official documentation for the latest version (4.0.0.rc1).][rubydocs]
10
29
 
11
- ----
12
-
13
- ### Note from the maintainer
14
-
15
- > Are you a fan of Shoulda Matchers? Are you interested in maintaining a popular
16
- > open-source project? If so, please contact me. Don't misunderstand me -- I
17
- > still use Shoulda Matchers on every project, but unfortunately, it has been a
18
- > long while since I've been able to give it the love it deserves, and I'd like
19
- > to hand the reins over to someone else who is able to do that. If you're
20
- > interested, I can be reached on Twitter as @mcmire or at
21
- > <elliot.winkler@gmail.com>. Thanks!
22
- >
23
- > -- Elliot
24
-
25
- ----
26
-
27
- ### ActiveModel matchers
28
-
29
- * **[allow_mass_assignment_of](lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb)**
30
- tests usage of Rails 3's `attr_accessible` and `attr_protected` macros.
31
- * **[allow_value](lib/shoulda/matchers/active_model/allow_value_matcher.rb)**
32
- tests that an attribute is valid or invalid if set to one or more values.
33
- *(Aliased as #allow_values.)*
34
- * **[have_secure_password](lib/shoulda/matchers/active_model/have_secure_password_matcher.rb)**
35
- tests usage of `has_secure_password`.
36
- * **[validate_absence_of](lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb)**
37
- tests usage of `validates_absence_of`.
38
- * **[validate_acceptance_of](lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb)**
39
- tests usage of `validates_acceptance_of`.
40
- * **[validate_confirmation_of](lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb)**
41
- tests usage of `validates_confirmation_of`.
42
- * **[validate_exclusion_of](lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb)**
43
- tests usage of `validates_exclusion_of`.
44
- * **[validate_inclusion_of](lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb)**
45
- tests usage of `validates_inclusion_of`.
46
- * **[validate_length_of](lib/shoulda/matchers/active_model/validate_length_of_matcher.rb)**
47
- tests usage of `validates_length_of`.
48
- * **[validate_numericality_of](lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb)**
49
- tests usage of `validates_numericality_of`.
50
- * **[validate_presence_of](lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb)**
51
- tests usage of `validates_presence_of`.
52
-
53
- ### ActiveRecord matchers
54
-
55
- * **[accept_nested_attributes_for](lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb)**
56
- tests usage of the `accepts_nested_attributes_for` macro.
57
- * **[belong_to](lib/shoulda/matchers/active_record/association_matcher.rb)**
58
- tests your `belongs_to` associations.
59
- * **[define_enum_for](lib/shoulda/matchers/active_record/define_enum_for_matcher.rb)**
60
- tests usage of the `enum` macro.
61
- * **[have_and_belong_to_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
62
- tests your `has_and_belongs_to_many` associations.
63
- * **[have_db_column](lib/shoulda/matchers/active_record/have_db_column_matcher.rb)**
64
- tests that the table that backs your model has a specific column.
65
- * **[have_db_index](lib/shoulda/matchers/active_record/have_db_index_matcher.rb)**
66
- tests that the table that backs your model has an index on a specific column.
67
- * **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
68
- tests your `has_many` associations.
69
- * **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb)**
70
- tests your `has_one` associations.
71
- * **[have_readonly_attribute](lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb)**
72
- tests usage of the `attr_readonly` macro.
73
- * **[serialize](lib/shoulda/matchers/active_record/serialize_matcher.rb)** tests
74
- usage of the `serialize` macro.
75
- * **[validate_uniqueness_of](lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb)**
76
- tests usage of `validates_uniqueness_of`.
77
-
78
- ### ActionController matchers
79
-
80
- * **[filter_param](lib/shoulda/matchers/action_controller/filter_param_matcher.rb)**
81
- tests parameter filtering configuration.
82
- * **[permit](lib/shoulda/matchers/action_controller/permit_matcher.rb)** tests
83
- that an action places a restriction on the `params` hash.
84
- * **[redirect_to](lib/shoulda/matchers/action_controller/redirect_to_matcher.rb)**
85
- tests that an action redirects to a certain location.
86
- * **[render_template](lib/shoulda/matchers/action_controller/render_template_matcher.rb)**
87
- tests that an action renders a template.
88
- * **[render_with_layout](lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb)**
89
- tests that an action is rendered with a certain layout.
90
- * **[rescue_from](lib/shoulda/matchers/action_controller/rescue_from_matcher.rb)**
91
- tests usage of the `rescue_from` macro.
92
- * **[respond_with](lib/shoulda/matchers/action_controller/respond_with_matcher.rb)**
93
- tests that an action responds with a certain status code.
94
- * **[route](lib/shoulda/matchers/action_controller/route_matcher.rb)** tests
95
- your routes.
96
- * **[set_session](lib/shoulda/matchers/action_controller/set_session_matcher.rb)**
97
- makes assertions on the `session` hash.
98
- * **[set_flash](lib/shoulda/matchers/action_controller/set_flash_matcher.rb)**
99
- makes assertions on the `flash` hash.
100
- * **[use_after_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L79)**
101
- tests that an `after_action` callback is defined in your controller. *(Aliased
102
- as #use_after_filter.)*
103
- * **[use_around_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L129)**
104
- tests that an `around_action` callback is defined in your controller. *(Aliased
105
- as #use_around_filter.)*
106
- * **[use_before_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L54)**
107
- tests that a `before_action` callback is defined in your controller. *(Aliased
108
- as #use_before_filter.)*
30
+ ## Compatibility
109
31
 
110
- ### Independent matchers
32
+ Shoulda Matchers 4 is tested and supported against Rails 5.x, Rails 4.2, RSpec
33
+ 3.x, Minitest 5, Minitest 4, and Ruby 2.2+.
111
34
 
112
- * **[delegate_method](lib/shoulda/matchers/independent/delegate_method_matcher.rb)**
113
- tests that an object forwards messages to other, internal objects by way of
114
- delegation.
35
+ For Rails 4.0/4.1 and Ruby 2.0/2.1 compatibility, please use shoulda-matchers
36
+ [3.1.2](https://github.com/thoughtbot/shoulda-matchers/releases/tag/v3.1.2).
115
37
 
116
38
  ## Getting started
117
39
 
118
40
  ### RSpec
119
41
 
120
- Include `shoulda-matchers` in your Gemfile:
121
-
122
- For Rails 4.x:
123
-
124
- ``` ruby
125
- group :test do
126
- gem 'shoulda-matchers', '~> 3.1'
127
- end
128
- ```
129
-
130
- For Rails 5.0:
42
+ Start by including `shoulda-matchers` in your Gemfile:
131
43
 
132
- ``` ruby
44
+ ```ruby
133
45
  group :test do
134
-  gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers.git', branch: 'rails-5'
46
+ gem 'shoulda-matchers', '4.0.0.rc1'
47
+ gem 'rails-controller-testing' # If you are using Rails 5.x
135
48
  end
136
49
  ```
137
50
 
@@ -143,7 +56,7 @@ Now you need to tell the gem a couple of things:
143
56
  You can supply this information by using a configuration block. Place the
144
57
  following in `rails_helper.rb`:
145
58
 
146
- ``` ruby
59
+ ```ruby
147
60
  Shoulda::Matchers.configure do |config|
148
61
  config.integrate do |with|
149
62
  # Choose a test framework:
@@ -156,16 +69,16 @@ Shoulda::Matchers.configure do |config|
156
69
  with.library :active_record
157
70
  with.library :active_model
158
71
  with.library :action_controller
159
- # Or, choose the following (which implies all of the above):
72
+ # Or, choose all of the above:
160
73
  with.library :rails
161
74
  end
162
75
  end
163
76
  ```
164
77
 
165
- Now you can use matchers in your tests. For instance a model test might look
78
+ Now you can use matchers in your tests. For instance, a model test might look
166
79
  like this:
167
80
 
168
- ``` ruby
81
+ ```ruby
169
82
  RSpec.describe Person, type: :model do
170
83
  it { should validate_presence_of(:name) }
171
84
  end
@@ -190,7 +103,7 @@ different levels where you can use these matchers:
190
103
  to use model matchers in certain example groups, you'll need to manually include
191
104
  them. Here's a good way of doing that:
192
105
 
193
- ``` ruby
106
+ ```ruby
194
107
  RSpec.configure do |config|
195
108
  config.include(Shoulda::Matchers::ActiveModel, type: :model)
196
109
  config.include(Shoulda::Matchers::ActiveRecord, type: :model)
@@ -199,7 +112,7 @@ end
199
112
 
200
113
  Then you can say:
201
114
 
202
- ``` ruby
115
+ ```ruby
203
116
  describe MySpecialModel, type: :model do
204
117
  # ...
205
118
  end
@@ -213,7 +126,7 @@ form works regardless of how you've configured RSpec -- meaning you can still
213
126
  use it even when using the `expect` syntax. But if you prefer to use
214
127
  `is_expected.to`, you can do that too:
215
128
 
216
- ``` ruby
129
+ ```ruby
217
130
  RSpec.describe Person, type: :model do
218
131
  it { is_expected.to validate_presence_of(:name) }
219
132
  end
@@ -225,7 +138,7 @@ Shoulda Matchers was originally a component of [Shoulda][shoulda], a gem that
225
138
  also provides `should` and `context` syntax via
226
139
  [`shoulda-context`][shoulda-context].
227
140
 
228
- At the moment, `shoulda` has not been updated to support `shoulda-matchers` 3.x,
141
+ At the moment, `shoulda` has not been updated to support `shoulda-matchers` 3.x and 4.x,
229
142
  so you'll want to add the following to your Gemfile:
230
143
 
231
144
  ```ruby
@@ -238,72 +151,97 @@ end
238
151
  Now you can use matchers in your tests. For instance a model test might look
239
152
  like this:
240
153
 
241
- ``` ruby
154
+ ```ruby
242
155
  class PersonTest < ActiveSupport::TestCase
243
156
  should validate_presence_of(:name)
244
157
  end
245
158
  ```
246
159
 
247
- ## Running tests
248
-
249
- ### Unit tests
160
+ ## Matchers
250
161
 
251
- Unit tests are the most common kind of tests in this gem, and the best way to
252
- run them is by using [Zeus].
253
-
254
- You'll want to run `zeus start` in one shell, then in another shell, instead of
255
- using `rspec` to run tests, you can use `zeus rspec`. So for instance, you might
256
- say:
257
-
258
- ```
259
- zeus rspec spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
260
- ```
261
-
262
- As a shortcut, you can also drop the initial part of the path and say this
263
- instead:
264
-
265
- ```
266
- zeus rspec active_model/validate_inclusion_of_matcher_spec.rb
267
- ```
268
-
269
- ### Acceptance tests
270
-
271
- The gem uses [Appraisal] to test against multiple versions of Rails and Ruby.
272
- This means that if you're trying to run a single test file, you'll need to
273
- specify which appraisal to use. For instance, you can't simply say:
274
-
275
- ```
276
- rspec spec/acceptance/active_model_integration_spec.rb
277
- ```
278
-
279
- Instead, you need to say
280
-
281
- ```
282
- bundle exec appraisal 4.2 rspec spec/acceptance/active_model_integration_spec.rb
283
- ```
284
-
285
- ### All tests
286
-
287
- You can run all tests by saying:
162
+ ### ActiveModel matchers
288
163
 
289
- ```
290
- bundle exec rake
291
- ```
164
+ * **[allow_value](lib/shoulda/matchers/active_model/allow_value_matcher.rb)**
165
+ tests that an attribute is valid or invalid if set to one or more values.
166
+ *(Aliased as #allow_values.)*
167
+ * **[have_secure_password](lib/shoulda/matchers/active_model/have_secure_password_matcher.rb)**
168
+ tests usage of `has_secure_password`.
169
+ * **[validate_absence_of](lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb)**
170
+ tests usage of `validates_absence_of`.
171
+ * **[validate_acceptance_of](lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb)**
172
+ tests usage of `validates_acceptance_of`.
173
+ * **[validate_confirmation_of](lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb)**
174
+ tests usage of `validates_confirmation_of`.
175
+ * **[validate_exclusion_of](lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb)**
176
+ tests usage of `validates_exclusion_of`.
177
+ * **[validate_inclusion_of](lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb)**
178
+ tests usage of `validates_inclusion_of`.
179
+ * **[validate_length_of](lib/shoulda/matchers/active_model/validate_length_of_matcher.rb)**
180
+ tests usage of `validates_length_of`.
181
+ * **[validate_numericality_of](lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb)**
182
+ tests usage of `validates_numericality_of`.
183
+ * **[validate_presence_of](lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb)**
184
+ tests usage of `validates_presence_of`.
292
185
 
293
- ## Generating documentation
186
+ ### ActiveRecord matchers
294
187
 
295
- YARD is used to generate documentation, which can be viewed [online][rubydocs].
296
- You can preview changes you make to the documentation locally by running
188
+ * **[accept_nested_attributes_for](lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb)**
189
+ tests usage of the `accepts_nested_attributes_for` macro.
190
+ * **[belong_to](lib/shoulda/matchers/active_record/association_matcher.rb)**
191
+ tests your `belongs_to` associations.
192
+ * **[define_enum_for](lib/shoulda/matchers/active_record/define_enum_for_matcher.rb)**
193
+ tests usage of the `enum` macro.
194
+ * **[have_and_belong_to_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
195
+ tests your `has_and_belongs_to_many` associations.
196
+ * **[have_db_column](lib/shoulda/matchers/active_record/have_db_column_matcher.rb)**
197
+ tests that the table that backs your model has a specific column.
198
+ * **[have_db_index](lib/shoulda/matchers/active_record/have_db_index_matcher.rb)**
199
+ tests that the table that backs your model has an index on a specific column.
200
+ * **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
201
+ tests your `has_many` associations.
202
+ * **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb)**
203
+ tests your `has_one` associations.
204
+ * **[have_readonly_attribute](lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb)**
205
+ tests usage of the `attr_readonly` macro.
206
+ * **[serialize](lib/shoulda/matchers/active_record/serialize_matcher.rb)** tests
207
+ usage of the `serialize` macro.
208
+ * **[validate_uniqueness_of](lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb)**
209
+ tests usage of `validates_uniqueness_of`.
297
210
 
298
- yard doc
211
+ ### ActionController matchers
299
212
 
300
- from this directory. Then, open `doc/index.html` in your browser.
213
+ * **[filter_param](lib/shoulda/matchers/action_controller/filter_param_matcher.rb)**
214
+ tests parameter filtering configuration.
215
+ * **[permit](lib/shoulda/matchers/action_controller/permit_matcher.rb)** tests
216
+ that an action places a restriction on the `params` hash.
217
+ * **[redirect_to](lib/shoulda/matchers/action_controller/redirect_to_matcher.rb)**
218
+ tests that an action redirects to a certain location.
219
+ * **[render_template](lib/shoulda/matchers/action_controller/render_template_matcher.rb)**
220
+ tests that an action renders a template.
221
+ * **[render_with_layout](lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb)**
222
+ tests that an action is rendered with a certain layout.
223
+ * **[rescue_from](lib/shoulda/matchers/action_controller/rescue_from_matcher.rb)**
224
+ tests usage of the `rescue_from` macro.
225
+ * **[respond_with](lib/shoulda/matchers/action_controller/respond_with_matcher.rb)**
226
+ tests that an action responds with a certain status code.
227
+ * **[route](lib/shoulda/matchers/action_controller/route_matcher.rb)** tests
228
+ your routes.
229
+ * **[set_session](lib/shoulda/matchers/action_controller/set_session_matcher.rb)**
230
+ makes assertions on the `session` hash.
231
+ * **[set_flash](lib/shoulda/matchers/action_controller/set_flash_matcher.rb)**
232
+ makes assertions on the `flash` hash.
233
+ * **[use_after_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L79)**
234
+ tests that an `after_action` callback is defined in your controller.
235
+ * **[use_around_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L129)**
236
+ tests that an `around_action` callback is defined in your controller.
237
+ * **[use_before_action](lib/shoulda/matchers/action_controller/callback_matcher.rb#L54)**
238
+ tests that a `before_action` callback is defined in your controller.
301
239
 
302
- If you want to be able to regenerate the docs as you work without having to run
303
- `yard doc` over and over again, keep this command running in a separate terminal
304
- session:
240
+ ### Independent matchers
305
241
 
306
- rake docs:autogenerate
242
+ * **[delegate_method](lib/shoulda/matchers/independent/delegate_method_matcher.rb)**
243
+ tests that an object forwards messages to other, internal objects by way of
244
+ delegation.
307
245
 
308
246
  ## Contributing
309
247
 
@@ -314,11 +252,6 @@ If you'd like to contribute, please take a look at the
314
252
  [instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
315
253
  pull request.
316
254
 
317
- ## Compatibility
318
-
319
- Shoulda Matchers is tested and supported against Rails 4.x, RSpec 3.x, Minitest
320
- 5, Minitest 4, and Ruby 2.x.
321
-
322
255
  ## Versioning
323
256
 
324
257
  Shoulda Matchers follows Semantic Versioning 2.0 as defined at
@@ -326,32 +259,37 @@ Shoulda Matchers follows Semantic Versioning 2.0 as defined at
326
259
 
327
260
  ## License
328
261
 
329
- Shoulda Matchers is copyright © 2006-2016
330
- [thoughtbot, inc](https://thoughtbot.com/). It is free software,
262
+ Shoulda Matchers is copyright © 2006-2018
263
+ [thoughtbot, inc][thoughtbot-website]. It is free software,
331
264
  and may be redistributed under the terms specified in the
332
265
  [MIT-LICENSE](MIT-LICENSE) file.
333
266
 
334
267
  ## About thoughtbot
335
268
 
336
- ![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
269
+ ![thoughtbot][thoughtbot-logo]
337
270
 
338
- Shoulda Matchers is maintained and funded by thoughtbot, inc.
339
- The names and logos for thoughtbot are trademarks of thoughtbot, inc.
271
+ Shoulda Matchers is maintained and funded by thoughtbot, inc. The names and
272
+ logos for thoughtbot are trademarks of thoughtbot, inc.
340
273
 
341
- We are passionate about open source software.
342
- See [our other projects][community].
343
- We are [available for hire][hire].
274
+ We are passionate about open source software. See [our other
275
+ projects][community]. We are [available for hire][hire].
344
276
 
277
+ [rubydocs]: http://matchers.shoulda.io/docs/v4.0.0.rc1
345
278
  [community]: https://thoughtbot.com/community?utm_source=github
346
279
  [hire]: https://thoughtbot.com?utm_source=github
347
- [version-badge]: http://img.shields.io/gem/v/shoulda-matchers.svg
348
- [rubygems]: http://rubygems.org/gems/shoulda-matchers
349
- [travis-badge]: http://img.shields.io/travis/thoughtbot/shoulda-matchers/master.svg
350
- [travis]: http://travis-ci.org/thoughtbot/shoulda-matchers
351
- [downloads-badge]: http://img.shields.io/gem/dtv/shoulda-matchers.svg
352
- [rubydocs]: http://matchers.shoulda.io/docs
280
+ [version-badge]: https://img.shields.io/gem/v/shoulda-matchers.svg
281
+ [rubygems]: httpss://rubygems.org/gems/shoulda-matchers
282
+ [travis-badge]: https://img.shields.io/travis/thoughtbot/shoulda-matchers/master.svg
283
+ [travis]: https://travis-ci.org/thoughtbot/shoulda-matchers
284
+ [downloads-badge]: https://img.shields.io/gem/dtv/shoulda-matchers.svg
353
285
  [contributors]: https://github.com/thoughtbot/shoulda-matchers/contributors
354
- [shoulda]: http://github.com/thoughtbot/shoulda
355
- [shoulda-context]: http://github.com/thoughtbot/shoulda-context
286
+ [shoulda]: https://github.com/thoughtbot/shoulda
287
+ [shoulda-context]: https://github.com/thoughtbot/shoulda-context
356
288
  [Zeus]: https://github.com/burke/zeus
357
289
  [Appraisal]: https://github.com/thoughtbot/appraisal
290
+ [hound-badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
291
+ [hound]: https://houndci.com
292
+ [thoughtbot-website]: https://thoughtbot.com
293
+ [thoughtbot-logo]: https://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg
294
+ [logo]: https://matchers.shoulda.io/images/shoulda-matchers-logo.png
295
+ [website]: https://matchers.shoulda.io/
data/Rakefile CHANGED
@@ -34,6 +34,13 @@ task :default do
34
34
  end
35
35
  end
36
36
 
37
+ namespace :appraisal do
38
+ task :list do
39
+ appraisals = Tests::CurrentBundle.instance.available_appraisals
40
+ puts "Valid appraisals: #{appraisals.join(', ')}"
41
+ end
42
+ end
43
+
37
44
  Shoulda::Matchers::DocumentationTasks.create
38
45
 
39
46
  task release: 'docs:publish_latest'