shoulda-matchers 4.2.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/{MIT-LICENSE → LICENSE} +1 -1
  3. data/README.md +167 -85
  4. data/lib/shoulda/matchers/action_controller/callback_matcher.rb +4 -2
  5. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +3 -2
  6. data/lib/shoulda/matchers/action_controller/permit_matcher.rb +26 -21
  7. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +6 -8
  8. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +6 -8
  9. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +16 -13
  10. data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +2 -1
  11. data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -6
  12. data/lib/shoulda/matchers/action_controller/route_params.rb +1 -1
  13. data/lib/shoulda/matchers/action_controller/set_session_or_flash_matcher.rb +19 -13
  14. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +18 -16
  15. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +29 -27
  16. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb +1 -1
  17. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +5 -5
  18. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb +2 -2
  19. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb +1 -1
  20. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb +1 -1
  21. data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +1 -1
  22. data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +51 -25
  23. data/lib/shoulda/matchers/active_model/helpers.rb +1 -1
  24. data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +32 -30
  25. data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +1 -1
  26. data/lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb +1 -1
  27. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +9 -1
  28. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +2 -2
  29. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +9 -8
  30. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +28 -46
  31. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +33 -9
  32. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +71 -26
  33. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +2 -2
  34. data/lib/shoulda/matchers/active_model/validation_matcher.rb +31 -6
  35. data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +2 -4
  36. data/lib/shoulda/matchers/active_model/validation_message_finder.rb +2 -4
  37. data/lib/shoulda/matchers/active_model/validator.rb +3 -3
  38. data/lib/shoulda/matchers/active_record.rb +26 -23
  39. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +6 -3
  40. data/lib/shoulda/matchers/active_record/association_matcher.rb +118 -47
  41. data/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb +5 -2
  42. data/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb +4 -4
  43. data/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb +1 -1
  44. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +11 -6
  45. data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +14 -15
  46. data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +30 -8
  47. data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +23 -5
  48. data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +3 -3
  49. data/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb +1 -1
  50. data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +3 -3
  51. data/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb +3 -2
  52. data/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb +7 -5
  53. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +8 -8
  54. data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +185 -0
  55. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +39 -17
  56. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
  57. data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
  58. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +12 -10
  59. data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +83 -0
  60. data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +30 -9
  61. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +13 -9
  62. data/lib/shoulda/matchers/active_record/uniqueness.rb +1 -1
  63. data/lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb +1 -3
  64. data/lib/shoulda/matchers/active_record/uniqueness/test_models.rb +0 -2
  65. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +80 -73
  66. data/lib/shoulda/matchers/doublespeak.rb +2 -1
  67. data/lib/shoulda/matchers/doublespeak/double.rb +1 -1
  68. data/lib/shoulda/matchers/doublespeak/double_collection.rb +3 -3
  69. data/lib/shoulda/matchers/doublespeak/double_implementation_registry.rb +8 -5
  70. data/lib/shoulda/matchers/doublespeak/object_double.rb +1 -1
  71. data/lib/shoulda/matchers/doublespeak/stub_implementation.rb +1 -5
  72. data/lib/shoulda/matchers/doublespeak/world.rb +2 -2
  73. data/lib/shoulda/matchers/error.rb +1 -1
  74. data/lib/shoulda/matchers/independent.rb +0 -1
  75. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +14 -13
  76. data/lib/shoulda/matchers/integrations/configuration.rb +1 -1
  77. data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
  78. data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -2
  79. data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
  80. data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
  81. data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
  82. data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
  83. data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
  84. data/lib/shoulda/matchers/rails_shim.rb +9 -3
  85. data/lib/shoulda/matchers/util.rb +16 -4
  86. data/lib/shoulda/matchers/util/word_wrap.rb +8 -8
  87. data/lib/shoulda/matchers/version.rb +1 -1
  88. data/lib/shoulda/matchers/warn.rb +3 -3
  89. data/shoulda-matchers.gemspec +10 -7
  90. metadata +11 -9
  91. data/lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 153f24e7ae0c3f3e4cc672663e3b718d15c5c1c809c6bab7ff3b418038b4ba71
4
- data.tar.gz: 88ceb4268aa3cb820661e0ec4c41b04e1affedf68917e809f0e7fa33aff8d634
3
+ metadata.gz: a62f760706ab97ba90edd181dbdf330ce6e8203c8ec3ec37a258022e202a53a6
4
+ data.tar.gz: 68f333b57646a8a437b73ff43f617efa9231674fb92f68de73365eb1408932f0
5
5
  SHA512:
6
- metadata.gz: 2acfc2606814dada7608e2fe9f3fec032493ee316ebfeaeb94cb0c9d47fca23b702f5e54f4c74356a78bf952eb6cc8c42c74636a9b01201afe69a6c56504a8b7
7
- data.tar.gz: c8db9ff17937194f55950b34cb56a6a71f922634dda173aad454e26915096b3201696b09ff75fe323034922a5d40b3d88a538365f9a58e8a6628e72ecf2855cb
6
+ metadata.gz: ea01851ee8521ff08ab6b1caea192c161e34286e5fd361cbceb6b84404813fa952acb73c70481c3140b2c5116ffce8bb386bf1feea70754f827a3918292b1bfb
7
+ data.tar.gz: 286ac5e78d534651889c5e3ed3843e1afa50d0fd77ed896c4ca3cf3622596cb7e1f47d2ae053e38100ce443dbfd80fbf1a8d099ecdfbbcf8d70912dbe3f42ad3
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2020, Tammer Saleh and thoughtbot, inc.
1
+ Copyright (c) 2006-2021 Tammer Saleh and thoughtbot, inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Shoulda Matchers [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge] [![Hound][hound-badge]][hound]
1
+ # Shoulda Matchers [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] [![Total Downloads][downloads-total]][rubygems] [![Downloads][downloads-badge]][rubygems]
2
2
 
3
3
  [version-badge]: https://img.shields.io/gem/v/shoulda-matchers.svg
4
4
  [rubygems]: https://rubygems.org/gems/shoulda-matchers
5
5
  [travis-badge]: https://img.shields.io/travis/thoughtbot/shoulda-matchers/master.svg
6
6
  [travis]: https://travis-ci.org/thoughtbot/shoulda-matchers
7
+ [downloads-total]: https://img.shields.io/gem/dt/shoulda-matchers.svg
8
+ [downloads-badge]: https://img.shields.io/gem/dtv/shoulda-matchers.svg
7
9
  [downloads-badge]: https://img.shields.io/gem/dtv/shoulda-matchers.svg
8
- [hound-badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
9
- [hound]: https://houndci.com
10
10
 
11
11
  [![shoulda-matchers][logo]][website]
12
12
 
@@ -20,10 +20,10 @@ complex, and error-prone.
20
20
  ## Quick links
21
21
 
22
22
  📖 **[Read the documentation for the latest version][rubydocs].**
23
- 📢 **[See what's changed in a recent version][news].**
23
+ 📢 **[See what's changed in recent versions][changelog].**
24
24
 
25
- [rubydocs]: http://matchers.shoulda.io/docs
26
- [news]: NEWS.md
25
+ [rubydocs]: https://matchers.shoulda.io/docs
26
+ [changelog]: CHANGELOG.md
27
27
 
28
28
  ## Table of contents
29
29
 
@@ -39,10 +39,12 @@ complex, and error-prone.
39
39
  * [ActiveRecord matchers](#activerecord-matchers)
40
40
  * [ActionController matchers](#actioncontroller-matchers)
41
41
  * [Independent matchers](#independent-matchers)
42
- * [Compatibility](#compatibility)
42
+ * [Extensions](#extensions)
43
43
  * [Contributing](#contributing)
44
+ * [Compatibility](#compatibility)
44
45
  * [Versioning](#versioning)
45
- * [License](#license)
46
+ * [Team](#team)
47
+ * [Copyright/License](#copyright-license)
46
48
  * [About thoughtbot](#about-thoughtbot)
47
49
 
48
50
  ## Getting started
@@ -53,21 +55,21 @@ Start by including `shoulda-matchers` in your Gemfile:
53
55
 
54
56
  ```ruby
55
57
  group :test do
56
- gem 'shoulda-matchers'
58
+ gem 'shoulda-matchers', '~> 4.0'
57
59
  end
58
60
  ```
59
61
 
60
- Now you need to tell the gem a couple of things:
62
+ Then run `bundle install`.
61
63
 
62
- * Which test framework you're using
63
- * Which portion of the matchers you want to use
64
+ Now you need to configure the gem by telling it:
64
65
 
65
- You can supply this information by providing a configuration block. Where this
66
- goes and what this contains depends on your project.
66
+ * which matchers you want to use in your tests
67
+ * that you're using RSpec so that it can make those matchers available in
68
+ your example groups
67
69
 
68
70
  #### Rails apps
69
71
 
70
- Assuming you are testing a Rails app, simply place this at the bottom of
72
+ If you're working on a Rails app, simply place this at the bottom of
71
73
  `spec/rails_helper.rb` (or in a support file if you so choose):
72
74
 
73
75
  ```ruby
@@ -79,13 +81,12 @@ Shoulda::Matchers.configure do |config|
79
81
  end
80
82
  ```
81
83
 
82
- Now you're ready to [use matchers in your tests](#usage)!
83
-
84
84
  #### Non-Rails apps
85
85
 
86
- If your project isn't a Rails app, but you still make use of ActiveRecord or
87
- ActiveModel, you can still use this gem too! In that case, you'll want to place
88
- the following configuration at the bottom of `spec/spec_helper.rb`:
86
+ If you're not working on a Rails app, but you still make use of ActiveRecord or
87
+ ActiveModel in your project, you can still use this gem too! In that case,
88
+ you'll want to place the following configuration at the bottom of
89
+ `spec/spec_helper.rb`:
89
90
 
90
91
  ```ruby
91
92
  Shoulda::Matchers.configure do |config|
@@ -99,45 +100,83 @@ Shoulda::Matchers.configure do |config|
99
100
  end
100
101
  ```
101
102
 
102
- Now you're ready to [use matchers in your tests](#usage)!
103
-
104
103
  ### Minitest
105
104
 
106
- Shoulda Matchers was originally a component of [Shoulda][shoulda], a gem that
107
- also provides `should` and `context` syntax via
108
- [`shoulda-context`][shoulda-context].
105
+ If you're using our umbrella gem [Shoulda], then make sure that you're using the
106
+ latest version:
107
+
108
+ ```ruby
109
+ group :test do
110
+ gem 'shoulda', '~> 4.0'
111
+ end
112
+ ```
109
113
 
110
- [shoulda]: https://github.com/thoughtbot/shoulda
111
- [shoulda-context]: https://github.com/thoughtbot/shoulda-context
114
+ [Shoulda]: https://github.com/thoughtbot/shoulda
112
115
 
113
- At the moment, `shoulda` has not been updated to support `shoulda-matchers` 3.x
114
- and 4.x, so you'll want to add the following to your Gemfile:
116
+ Otherwise, add `shoulda-matchers` to your Gemfile:
115
117
 
116
118
  ```ruby
117
119
  group :test do
118
- gem 'shoulda', '~> 3.5'
119
- gem 'shoulda-matchers', '~> 2.0'
120
- gem 'rails-controller-testing'
120
+ gem 'shoulda-matchers', '~> 4.0'
121
121
  end
122
122
  ```
123
123
 
124
- Now you're ready to [use matchers in your tests](#usage)!
124
+ Then run `bundle install`.
125
+
126
+ Now you need to configure the gem by telling it:
127
+
128
+ * which matchers you want to use in your tests
129
+ * that you're using Minitest so that it can make those matchers available in
130
+ your test case classes
131
+
132
+ #### Rails apps
133
+
134
+ If you're working on a Rails app, simply place this at the bottom of
135
+ `test/test_helper.rb`:
136
+
137
+ ```ruby
138
+ Shoulda::Matchers.configure do |config|
139
+ config.integrate do |with|
140
+ with.test_framework :minitest
141
+ with.library :rails
142
+ end
143
+ end
144
+ ```
145
+
146
+ #### Non-Rails apps
147
+
148
+ If you're not working on a Rails app, but you still make use of ActiveRecord or
149
+ ActiveModel in your project, you can still use this gem too! In that case,
150
+ you'll want to place the following configuration at the bottom of
151
+ `test/test_helper.rb`:
152
+
153
+ ```ruby
154
+ Shoulda::Matchers.configure do |config|
155
+ config.integrate do |with|
156
+ with.test_framework :minitest
157
+
158
+ # Keep as many of these lines as are necessary:
159
+ with.library :active_record
160
+ with.library :active_model
161
+ end
162
+ end
163
+ ```
125
164
 
126
165
  ## Usage
127
166
 
128
- The matchers provided by this gem are divided into different categories
129
- depending on what you're testing within your Rails app:
167
+ Most of the matchers provided by this gem are useful in a Rails context, and as
168
+ such, can be used for different parts of a Rails app:
130
169
 
131
170
  * [database models backed by ActiveRecord](#activemodel-matchers)
132
171
  * [non-database models, form objects, etc. backed by
133
172
  ActiveModel](#activerecord-matchers)
134
173
  * [controllers](#actioncontroller-matchers)
135
174
  * [routes](#routing-matchers) (RSpec only)
136
- * [usage of Rails-specific features like `delegate`](#independent-matchers)
175
+ * [Rails-specific features like `delegate`](#independent-matchers)
137
176
 
138
- All matchers are designed to be prepended primarily with the word `should`,
139
- which is a special directive in both RSpec and Shoulda. For instance, a model
140
- test case may look something like:
177
+ As the name of the gem indicates, most matchers are designed to be used in
178
+ "one-liner" form using the `should` macro, a special directive available in both
179
+ RSpec and [Shoulda]. For instance, a model test case may look something like:
141
180
 
142
181
  ``` ruby
143
182
  # RSpec
@@ -165,16 +204,17 @@ class MenuItemTest < ActiveSupport::TestCase
165
204
  end
166
205
  ```
167
206
 
168
- For the full set of matchers you can use, [see below](#matchers).
207
+ [See below](#matchers) for the full set of matchers that you can use.
169
208
 
170
209
  ### On the subject of `subject`
171
210
 
172
211
  For both RSpec and Shoulda, the **subject** is an implicit reference to the
173
- object under test, and all of the matchers make use of it internally when they
174
- are run. This is always set automatically by your test framework in any given
175
- test case; however, in certain cases it can be advantageous to override the
176
- subject. For instance, when testing validations in a model, it is customary to
177
- provide a valid model instead of a fresh one:
212
+ object under test, and through the use of `should` as demonstrated above, all of
213
+ the matchers make use of `subject` internally when they are run. A `subject` is
214
+ always set automatically by your test framework in any given test case; however,
215
+ in certain cases it can be advantageous to override it. For instance, when
216
+ testing validations in a model, it is customary to provide a valid model instead
217
+ of a fresh one:
178
218
 
179
219
  ``` ruby
180
220
  # RSpec
@@ -232,11 +272,19 @@ end
232
272
 
233
273
  ### Availability of RSpec matchers in example groups
234
274
 
275
+ #### Rails projects
276
+
235
277
  If you're using RSpec, then you're probably familiar with the concept of example
236
- groups: these are different kinds of test cases, and each of them has special
237
- behavior around them. As alluded to [above](#usage), this gem works in a similar
238
- way, and there are matchers that are only available in certain types of example
239
- groups:
278
+ groups. Example groups can be assigned tags order to assign different behavior
279
+ to different kinds of example groups. This comes into play especially when using
280
+ `rspec-rails`, where, for instance, controller example groups, tagged with
281
+ `type: :controller`, are written differently than request example groups, tagged
282
+ with `type: :request`. This difference in writing style arises because
283
+ `rspec-rails` mixes different behavior and methods into controller example
284
+ groups vs. request example groups.
285
+
286
+ Relying on this behavior, Shoulda Matchers automatically makes certain matchers
287
+ available in certain kinds of example groups:
240
288
 
241
289
  * ActiveRecord and ActiveModel matchers are available only in model example
242
290
  groups, i.e., those tagged with `type: :model` or in files located under
@@ -248,13 +296,27 @@ groups:
248
296
  tagged with `type: :routing` or in files located under `spec/routing`.
249
297
  * Independent matchers are available in all example groups.
250
298
 
251
- As long as you're using Rails, you don't need to worry about this everything
252
- should "just work".
299
+ As long as you're using Rails, you don't need to worry about these details
300
+ everything should "just work".
301
+
302
+ #### Non-Rails projects
253
303
 
254
- **However, if you are using ActiveModel or ActiveRecord outside of Rails**, and
255
- you want to use model matchers in certain example groups, you'll need to
256
- manually include the module that holds those matchers. A good way to do this is
257
- to place the following in your `spec_helper.rb`:
304
+ **What if you are using ActiveModel or ActiveRecord outside of Rails, however,
305
+ and you want to use model matchers in a certain example group?** Then you'll
306
+ need to manually include the module that holds those matchers into that example
307
+ group. For instance, you might have to say:
308
+
309
+ ``` ruby
310
+ RSpec.describe MySpecialModel do
311
+ include Shoulda::Matchers::ActiveModel
312
+ include Shoulda::Matchers::ActiveRecord
313
+ end
314
+ ```
315
+
316
+ If you have a lot of similar example groups in which you need to do this, then
317
+ you might find it more helpful to tag your example groups appropriately, then
318
+ instruct RSpec to mix these modules into any example groups that have that tag.
319
+ For instance, you could add this to your `rails_helper.rb`:
258
320
 
259
321
  ```ruby
260
322
  RSpec.configure do |config|
@@ -263,21 +325,20 @@ RSpec.configure do |config|
263
325
  end
264
326
  ```
265
327
 
266
- Then you can say:
328
+ And from then on, you could say:
267
329
 
268
330
  ```ruby
269
- describe MySpecialModel, type: :model do
331
+ RSpec.describe MySpecialModel, type: :model do
270
332
  # ...
271
333
  end
272
334
  ```
273
335
 
274
336
  ### `should` vs `is_expected.to`
275
337
 
276
- In this README and throughout the documentation, we're using the `should` form
277
- of RSpec's one-liner syntax over `is_expected.to`. The `should` form works
278
- regardless of how you've configured RSpec meaning you can still use it even
279
- when using the `expect` syntax. But if you prefer to use `is_expected.to`, you
280
- can do that too:
338
+ In this README and throughout the documentation, you'll notice that we use the
339
+ `should` form of RSpec's one-liner syntax over `is_expected.to`. Beside being
340
+ the namesake of the gem itself, this is our preferred syntax as it's short and
341
+ sweet. But if you prefer to use `is_expected.to`, you can do that too:
281
342
 
282
343
  ```ruby
283
344
  RSpec.describe Person, type: :model do
@@ -287,7 +348,7 @@ end
287
348
 
288
349
  ## Matchers
289
350
 
290
- The following is a list of matchers shipped with the gem. If you need details
351
+ Here is the full list of matchers that ship with this gem. If you need details
291
352
  about any of them, make sure to [consult the documentation][rubydocs]!
292
353
 
293
354
  ### ActiveModel matchers
@@ -322,18 +383,26 @@ about any of them, make sure to [consult the documentation][rubydocs]!
322
383
  tests your `belongs_to` associations.
323
384
  * **[define_enum_for](lib/shoulda/matchers/active_record/define_enum_for_matcher.rb)**
324
385
  tests usage of the `enum` macro.
325
- * **[have_and_belong_to_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
386
+ * **[have_and_belong_to_many](lib/shoulda/matchers/active_record/association_matcher.rb#L827)**
326
387
  tests your `has_and_belongs_to_many` associations.
327
388
  * **[have_db_column](lib/shoulda/matchers/active_record/have_db_column_matcher.rb)**
328
389
  tests that the table that backs your model has a specific column.
329
390
  * **[have_db_index](lib/shoulda/matchers/active_record/have_db_index_matcher.rb)**
330
391
  tests that the table that backs your model has an index on a specific column.
331
- * **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
392
+ * **[have_implicit_order_column](lib/shoulda/matchers/active_record/have_implicit_order_column.rb)**
393
+ tests usage of `implicit_order_column`.
394
+ * **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb#L328)**
332
395
  tests your `has_many` associations.
333
- * **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb)**
396
+ * **[have_many_attached](lib/shoulda/matchers/active_record/have_attached_matcher.rb)**
397
+ tests your `has_many_attached` associations.
398
+ * **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb#L598)**
334
399
  tests your `has_one` associations.
400
+ * **[have_one_attached](lib/shoulda/matchers/active_record/have_attached_matcher.rb)**
401
+ tests your `has_one_attached` associations.
335
402
  * **[have_readonly_attribute](lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb)**
336
403
  tests usage of the `attr_readonly` macro.
404
+ * **[have_rich_text](lib/shoulda/matchers/active_record/have_rich_text_matcher.rb)**
405
+ tests your `has_rich_text` associations.
337
406
  * **[serialize](lib/shoulda/matchers/active_record/serialize_matcher.rb)** tests
338
407
  usage of the `serialize` macro.
339
408
  * **[validate_uniqueness_of](lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb)**
@@ -379,37 +448,51 @@ about any of them, make sure to [consult the documentation][rubydocs]!
379
448
  tests that an object forwards messages to other, internal objects by way of
380
449
  delegation.
381
450
 
382
- ## Compatibility
451
+ ## Extensions
383
452
 
384
- Shoulda Matchers is tested and supported against Ruby 2.4+, Rails 5.x, Rails
385
- 4.2.x, RSpec 3.x, and Minitest 5.x.
453
+ Over time our community has created extensions to Shoulda Matchers. If you've
454
+ created something that you want to share, please [let us know][new-issue]!
386
455
 
387
- For Ruby < 2.4 and Rails < 4.1 compatibility, please use [v3.1.3][v3.1.3].
456
+ * **[shoulda-matchers-cucumber]** Adds support for using Shoulda Matchers in
457
+ Cucumber tests.
388
458
 
389
- [v3.1.3]: https://github.com/thoughtbot/shoulda-matchers/releases/tag/v3.1.3
459
+ [new-issue]: https://github.com/thoughtbot/shoulda-matchers/issues/new
460
+ [shoulda-matchers-cucumber]: https://github.com/majioa/shoulda-matchers-cucumber
390
461
 
391
462
  ## Contributing
392
463
 
393
- Shoulda Matchers is open source, and we are grateful for
394
- [everyone][contributors] who's contributed so far.
464
+ Have a fix for a problem you've been running into or an idea for a new feature
465
+ you think would be useful? Take a look at the [Contributing
466
+ document](CONTRIBUTING.md) for instructions on setting up the repo on your
467
+ machine, understanding the codebase, and creating a good pull request.
395
468
 
396
- [contributors]: https://github.com/thoughtbot/shoulda-matchers/contributors
469
+ ## Compatibility
397
470
 
398
- If you'd like to contribute, please take a look at the
399
- [instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
400
- pull request.
471
+ Shoulda Matchers is [tested][travis] and supported against Ruby 2.4+, Rails
472
+ 4.2+, RSpec 3.x, and Minitest 5.x.
473
+
474
+ For Ruby < 2.4 and Rails < 4.1 compatibility, please use [v3.1.3][v3.1.3].
475
+
476
+ [v3.1.3]: https://github.com/thoughtbot/shoulda-matchers/tree/v3.1.3
401
477
 
402
478
  ## Versioning
403
479
 
404
480
  Shoulda Matchers follows Semantic Versioning 2.0 as defined at
405
- <http://semver.org>.
481
+ <https://semver.org>.
482
+
483
+ ## Team
484
+
485
+ Shoulda Matchers is maintained by [Elliot Winkler][mcmire] and [Gui
486
+ Albuk][guialbuk].
487
+
488
+ [mcmire]: https://github.com/mcmire
489
+ [guialbuk]: https://github.com/guialbuk
406
490
 
407
- ## License
491
+ ## Copyright/License
408
492
 
409
- Shoulda Matchers is copyright © 2006-2020
410
- [thoughtbot, inc][thoughtbot-website]. It is free software,
411
- and may be redistributed under the terms specified in the
412
- [MIT-LICENSE](MIT-LICENSE) file.
493
+ Shoulda Matchers is copyright © 2006-2021 Tammer Saleh and [thoughtbot,
494
+ inc][thoughtbot-website]. It is free and opensource software and may be
495
+ redistributed under the terms specified in the [LICENSE](LICENSE) file.
413
496
 
414
497
  [thoughtbot-website]: https://thoughtbot.com
415
498
 
@@ -419,8 +502,7 @@ and may be redistributed under the terms specified in the
419
502
 
420
503
  [thoughtbot-logo]: https://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg
421
504
 
422
- Shoulda Matchers is maintained and funded by thoughtbot, inc. The names and
423
- logos for thoughtbot are trademarks of thoughtbot, inc.
505
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
424
506
 
425
507
  We are passionate about open source software. See [our other
426
508
  projects][community]. We are [available for hire][hire].
@@ -179,11 +179,13 @@ module Shoulda
179
179
  end
180
180
 
181
181
  def failure_message
182
- "Expected that #{controller_class.name} would have :#{method_name} as a #{kind}_#{callback_type}"
182
+ "Expected that #{controller_class.name} would have :#{method_name}"\
183
+ " as a #{kind}_#{callback_type}"
183
184
  end
184
185
 
185
186
  def failure_message_when_negated
186
- "Expected that #{controller_class.name} would not have :#{method_name} as a #{kind}_#{callback_type}"
187
+ "Expected that #{controller_class.name} would not have"\
188
+ " :#{method_name} as a #{kind}_#{callback_type}"
187
189
  end
188
190
 
189
191
  def description