shoulda-matchers 4.1.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +163 -79
  3. data/lib/shoulda/matchers.rb +13 -12
  4. data/lib/shoulda/matchers/action_controller.rb +13 -13
  5. data/lib/shoulda/matchers/active_model.rb +15 -26
  6. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +11 -2
  7. data/lib/shoulda/matchers/active_model/numericality_matchers.rb +5 -0
  8. data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +5 -1
  9. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +1 -1
  10. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +2 -21
  11. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +27 -3
  12. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +32 -0
  13. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +46 -19
  14. data/lib/shoulda/matchers/active_model/validation_matcher.rb +27 -0
  15. data/lib/shoulda/matchers/active_record.rb +13 -22
  16. data/lib/shoulda/matchers/active_record/association_matcher.rb +23 -7
  17. data/lib/shoulda/matchers/active_record/association_matchers.rb +12 -0
  18. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +2 -2
  19. data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +12 -6
  20. data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +20 -3
  21. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +32 -5
  22. data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +147 -0
  23. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +1 -1
  24. data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
  25. data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +79 -0
  26. data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +28 -9
  27. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +2 -6
  28. data/lib/shoulda/matchers/active_record/uniqueness.rb +5 -5
  29. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +2 -2
  30. data/lib/shoulda/matchers/doublespeak.rb +8 -7
  31. data/lib/shoulda/matchers/independent.rb +0 -2
  32. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +3 -0
  33. data/lib/shoulda/matchers/integrations.rb +6 -6
  34. data/lib/shoulda/matchers/integrations/test_frameworks.rb +4 -2
  35. data/lib/shoulda/matchers/rails_shim.rb +60 -30
  36. data/lib/shoulda/matchers/util.rb +9 -4
  37. data/lib/shoulda/matchers/util/word_wrap.rb +1 -1
  38. data/lib/shoulda/matchers/version.rb +1 -1
  39. metadata +9 -8
  40. data/MIT-LICENSE +0 -22
  41. 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: 1856891b0a96aaa5ed99a48490288b2bbd3547c7779ab1d8477a33b61cbb0c7d
4
- data.tar.gz: b3768f6532318b37de78e6959a1c7be2e28e19b4618d966a7ca0dab0cfa96ceb
3
+ metadata.gz: 50d63f547edcfe3f040aff155386def4cf30b3b17befc2e24a3b29f9933d6aba
4
+ data.tar.gz: dc7066ab2357ddda9efe73ab7bfd547dae0a2b6c3180a4d68d3fb715708af500
5
5
  SHA512:
6
- metadata.gz: dc99bd232c8f9a3eeff2ea7b82b36821339b20090b40c750c282b48d413b99028fcb69ec775ecb37a43d7e6d59a0c090213c35ede384ed95303d010a5e00ed90
7
- data.tar.gz: 56dbd1bd6978b59743e6936118a535e276b7672f12a0b46b69b3baf164b6dcac0688ee26ec66ccb11b2d0af8d1374567d401ef1f46d3f54bd6d3ccee8cf55085
6
+ metadata.gz: a112316adba7fa8458cc8b4aa404152cf3618705f232002dddc7b1004f99f69a9717961d4893cfaff50e7d802ae30ea7837e70104bc4a497c9b560982ab80831
7
+ data.tar.gz: a732f1d0039ad911f35ee9f1d05a4cac8683232b253b42a59a8d6409ed285e292213bca8680e4c627f9fbd7ff27ba85dcc5d67a42885d571462456c385ec635a
data/README.md CHANGED
@@ -1,9 +1,11 @@
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] [![Hound][hound-badge]][hound]
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
10
  [hound-badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
9
11
  [hound]: https://houndci.com
@@ -19,11 +21,11 @@ complex, and error-prone.
19
21
 
20
22
  ## Quick links
21
23
 
22
- 📖 **[Read the documentation for the latest version (4.1.0)][rubydocs].**
23
- 📢 **[See what's changed in a recent version][news].**
24
+ 📖 **[Read the documentation for the latest version][rubydocs].**
25
+ 📢 **[See what's changed in recent versions][changelog].**
24
26
 
25
27
  [rubydocs]: http://matchers.shoulda.io/docs
26
- [news]: NEWS.md
28
+ [changelog]: CHANGELOG.md
27
29
 
28
30
  ## Table of contents
29
31
 
@@ -39,10 +41,12 @@ complex, and error-prone.
39
41
  * [ActiveRecord matchers](#activerecord-matchers)
40
42
  * [ActionController matchers](#actioncontroller-matchers)
41
43
  * [Independent matchers](#independent-matchers)
42
- * [Compatibility](#compatibility)
44
+ * [Extensions](#extensions)
43
45
  * [Contributing](#contributing)
46
+ * [Compatibility](#compatibility)
44
47
  * [Versioning](#versioning)
45
- * [License](#license)
48
+ * [Team](#team)
49
+ * [Copyright/License](#copyright-license)
46
50
  * [About thoughtbot](#about-thoughtbot)
47
51
 
48
52
  ## Getting started
@@ -53,21 +57,21 @@ Start by including `shoulda-matchers` in your Gemfile:
53
57
 
54
58
  ```ruby
55
59
  group :test do
56
- gem 'shoulda-matchers'
60
+ gem 'shoulda-matchers', '~> 4.0'
57
61
  end
58
62
  ```
59
63
 
60
- Now you need to tell the gem a couple of things:
64
+ Then run `bundle install`.
61
65
 
62
- * Which test framework you're using
63
- * Which portion of the matchers you want to use
66
+ Now you need to configure the gem by telling it:
64
67
 
65
- You can supply this information by providing a configuration block. Where this
66
- goes and what this contains depends on your project.
68
+ * which matchers you want to use in your tests
69
+ * that you're using RSpec so that it can make those matchers available in
70
+ your example groups
67
71
 
68
72
  #### Rails apps
69
73
 
70
- Assuming you are testing a Rails app, simply place this at the bottom of
74
+ If you're working on a Rails app, simply place this at the bottom of
71
75
  `spec/rails_helper.rb` (or in a support file if you so choose):
72
76
 
73
77
  ```ruby
@@ -79,13 +83,12 @@ Shoulda::Matchers.configure do |config|
79
83
  end
80
84
  ```
81
85
 
82
- Now you're ready to [use matchers in your tests](#usage)!
83
-
84
86
  #### Non-Rails apps
85
87
 
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`:
88
+ If you're not working on a Rails app, but you still make use of ActiveRecord or
89
+ ActiveModel in your project, you can still use this gem too! In that case,
90
+ you'll want to place the following configuration at the bottom of
91
+ `spec/spec_helper.rb`:
89
92
 
90
93
  ```ruby
91
94
  Shoulda::Matchers.configure do |config|
@@ -99,45 +102,83 @@ Shoulda::Matchers.configure do |config|
99
102
  end
100
103
  ```
101
104
 
102
- Now you're ready to [use matchers in your tests](#usage)!
103
-
104
105
  ### Minitest
105
106
 
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].
107
+ If you're using our umbrella gem [Shoulda], then make sure that you're using the
108
+ latest version:
109
+
110
+ ```ruby
111
+ group :test do
112
+ gem 'shoulda', '~> 4.0'
113
+ end
114
+ ```
109
115
 
110
- [shoulda]: https://github.com/thoughtbot/shoulda
111
- [shoulda-context]: https://github.com/thoughtbot/shoulda-context
116
+ [Shoulda]: https://github.com/thoughtbot/shoulda
112
117
 
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:
118
+ Otherwise, add `shoulda-matchers` to your Gemfile:
115
119
 
116
120
  ```ruby
117
121
  group :test do
118
- gem 'shoulda', '~> 3.5'
119
- gem 'shoulda-matchers', '~> 2.0'
120
- gem 'rails-controller-testing'
122
+ gem 'shoulda-matchers', '~> 4.0'
121
123
  end
122
124
  ```
123
125
 
124
- Now you're ready to [use matchers in your tests](#usage)!
126
+ Then run `bundle install`.
127
+
128
+ Now you need to configure the gem by telling it:
129
+
130
+ * which matchers you want to use in your tests
131
+ * that you're using Minitest so that it can make those matchers available in
132
+ your test case classes
133
+
134
+ #### Rails apps
135
+
136
+ If you're working on a Rails app, simply place this at the bottom of
137
+ `test/test_helper.rb`:
138
+
139
+ ```ruby
140
+ Shoulda::Matchers.configure do |config|
141
+ config.integrate do |with|
142
+ with.test_framework :minitest
143
+ with.library :rails
144
+ end
145
+ end
146
+ ```
147
+
148
+ #### Non-Rails apps
149
+
150
+ If you're not working on a Rails app, but you still make use of ActiveRecord or
151
+ ActiveModel in your project, you can still use this gem too! In that case,
152
+ you'll want to place the following configuration at the bottom of
153
+ `test/test_helper.rb`:
154
+
155
+ ```ruby
156
+ Shoulda::Matchers.configure do |config|
157
+ config.integrate do |with|
158
+ with.test_framework :minitest
159
+
160
+ # Keep as many of these lines as are necessary:
161
+ with.library :active_record
162
+ with.library :active_model
163
+ end
164
+ end
165
+ ```
125
166
 
126
167
  ## Usage
127
168
 
128
- The matchers provided by this gem are divided into different categories
129
- depending on what you're testing within your Rails app:
169
+ Most of the matchers provided by this gem are useful in a Rails context, and as
170
+ such, can be used for different parts of a Rails app:
130
171
 
131
172
  * [database models backed by ActiveRecord](#activemodel-matchers)
132
173
  * [non-database models, form objects, etc. backed by
133
174
  ActiveModel](#activerecord-matchers)
134
175
  * [controllers](#actioncontroller-matchers)
135
176
  * [routes](#routing-matchers) (RSpec only)
136
- * [usage of Rails-specific features like `delegate`](#independent-matchers)
177
+ * [Rails-specific features like `delegate`](#independent-matchers)
137
178
 
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:
179
+ As the name of the gem indicates, most matchers are designed to be used in
180
+ "one-liner" form using the `should` macro, a special directive available in both
181
+ RSpec and [Shoulda]. For instance, a model test case may look something like:
141
182
 
142
183
  ``` ruby
143
184
  # RSpec
@@ -165,16 +206,17 @@ class MenuItemTest < ActiveSupport::TestCase
165
206
  end
166
207
  ```
167
208
 
168
- For the full set of matchers you can use, [see below](#matchers).
209
+ [See below](#matchers) for the full set of matchers that you can use.
169
210
 
170
211
  ### On the subject of `subject`
171
212
 
172
213
  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:
214
+ object under test, and through the use of `should` as demonstrated above, all of
215
+ the matchers make use of `subject` internally when they are run. A `subject` is
216
+ always set automatically by your test framework in any given test case; however,
217
+ in certain cases it can be advantageous to override it. For instance, when
218
+ testing validations in a model, it is customary to provide a valid model instead
219
+ of a fresh one:
178
220
 
179
221
  ``` ruby
180
222
  # RSpec
@@ -232,11 +274,19 @@ end
232
274
 
233
275
  ### Availability of RSpec matchers in example groups
234
276
 
277
+ #### Rails projects
278
+
235
279
  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:
280
+ groups. Example groups can be assigned tags order to assign different behavior
281
+ to different kinds of example groups. This comes into play especially when using
282
+ `rspec-rails`, where, for instance, controller example groups, tagged with
283
+ `type: :controller`, are written differently than request example groups, tagged
284
+ with `type: :request`. This difference in writing style arises because
285
+ `rspec-rails` mixes different behavior and methods into controller example
286
+ groups vs. request example groups.
287
+
288
+ Relying on this behavior, Shoulda Matchers automatically makes certain matchers
289
+ available in certain kinds of example groups:
240
290
 
241
291
  * ActiveRecord and ActiveModel matchers are available only in model example
242
292
  groups, i.e., those tagged with `type: :model` or in files located under
@@ -248,13 +298,27 @@ groups:
248
298
  tagged with `type: :routing` or in files located under `spec/routing`.
249
299
  * Independent matchers are available in all example groups.
250
300
 
251
- As long as you're using Rails, you don't need to worry about this everything
252
- should "just work".
301
+ As long as you're using Rails, you don't need to worry about these details
302
+ everything should "just work".
303
+
304
+ #### Non-Rails projects
253
305
 
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`:
306
+ **What if you are using ActiveModel or ActiveRecord outside of Rails, however,
307
+ and you want to use model matchers in a certain example group?** Then you'll
308
+ need to manually include the module that holds those matchers into that example
309
+ group. For instance, you might have to say:
310
+
311
+ ``` ruby
312
+ RSpec.describe MySpecialModel do
313
+ include Shoulda::Matchers::ActiveModel
314
+ include Shoulda::Matchers::ActiveRecord
315
+ end
316
+ ```
317
+
318
+ If you have a lot of similar example groups in which you need to do this, then
319
+ you might find it more helpful to tag your example groups appropriately, then
320
+ instruct RSpec to mix these modules into any example groups that have that tag.
321
+ For instance, you could add this to your `rails_helper.rb`:
258
322
 
259
323
  ```ruby
260
324
  RSpec.configure do |config|
@@ -263,21 +327,20 @@ RSpec.configure do |config|
263
327
  end
264
328
  ```
265
329
 
266
- Then you can say:
330
+ And from then on, you could say:
267
331
 
268
332
  ```ruby
269
- describe MySpecialModel, type: :model do
333
+ RSpec.describe MySpecialModel, type: :model do
270
334
  # ...
271
335
  end
272
336
  ```
273
337
 
274
338
  ### `should` vs `is_expected.to`
275
339
 
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:
340
+ In this README and throughout the documentation, you'll notice that we use the
341
+ `should` form of RSpec's one-liner syntax over `is_expected.to`. Beside being
342
+ the namesake of the gem itself, this is our preferred syntax as it's short and
343
+ sweet. But if you prefer to use `is_expected.to`, you can do that too:
281
344
 
282
345
  ```ruby
283
346
  RSpec.describe Person, type: :model do
@@ -287,7 +350,7 @@ end
287
350
 
288
351
  ## Matchers
289
352
 
290
- The following is a list of matchers shipped with the gem. If you need details
353
+ Here is the full list of matchers that ship with this gem. If you need details
291
354
  about any of them, make sure to [consult the documentation][rubydocs]!
292
355
 
293
356
  ### ActiveModel matchers
@@ -328,12 +391,20 @@ about any of them, make sure to [consult the documentation][rubydocs]!
328
391
  tests that the table that backs your model has a specific column.
329
392
  * **[have_db_index](lib/shoulda/matchers/active_record/have_db_index_matcher.rb)**
330
393
  tests that the table that backs your model has an index on a specific column.
394
+ * **[have_implicit_order_column](lib/shoulda/matchers/active_record/have_implicit_order_column.rb)**
395
+ tests usage of `implicit_order_column`.
331
396
  * **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
332
397
  tests your `has_many` associations.
398
+ * **[have_many_attached](lib/shoulda/matchers/active_record/have_attached_matcher.rb)**
399
+ tests your `has_many_attached` associations.
333
400
  * **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb)**
334
401
  tests your `has_one` associations.
402
+ * **[have_one_attached](lib/shoulda/matchers/active_record/have_attached_matcher.rb)**
403
+ tests your `has_one_attached` associations.
335
404
  * **[have_readonly_attribute](lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb)**
336
405
  tests usage of the `attr_readonly` macro.
406
+ * **[have_rich_text](lib/shoulda/matchers/active_record/have_rich_text_matcher.rb)**
407
+ tests your `has_rich_text` associations.
337
408
  * **[serialize](lib/shoulda/matchers/active_record/serialize_matcher.rb)** tests
338
409
  usage of the `serialize` macro.
339
410
  * **[validate_uniqueness_of](lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb)**
@@ -379,37 +450,51 @@ about any of them, make sure to [consult the documentation][rubydocs]!
379
450
  tests that an object forwards messages to other, internal objects by way of
380
451
  delegation.
381
452
 
382
- ## Compatibility
453
+ ## Extensions
383
454
 
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.
455
+ Over time our community has created extensions to Shoulda Matchers. If you've
456
+ created something that you want to share, please [let us know][new-issue]!
386
457
 
387
- For Ruby < 2.4 and Rails < 4.1 compatibility, please use [v3.1.3][v3.1.3].
458
+ * **[shoulda-matchers-cucumber]** Adds support for using Shoulda Matchers in
459
+ Cucumber tests.
388
460
 
389
- [v3.1.3]: https://github.com/thoughtbot/shoulda-matchers/releases/tag/v3.1.3
461
+ [new-issue]: https://github.com/thoughtbot/shoulda-matchers/issues/new
462
+ [shoulda-matchers-cucumber]: https://github.com/majioa/shoulda-matchers-cucumber
390
463
 
391
464
  ## Contributing
392
465
 
393
- Shoulda Matchers is open source, and we are grateful for
394
- [everyone][contributors] who's contributed so far.
466
+ Have a fix for a problem you've been running into or an idea for a new feature
467
+ you think would be useful? Take a look at the [Contributing
468
+ document](CONTRIBUTING.md) for instructions on setting up the repo on your
469
+ machine, understanding the codebase, and creating a good pull request.
395
470
 
396
- [contributors]: https://github.com/thoughtbot/shoulda-matchers/contributors
471
+ ## Compatibility
397
472
 
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.
473
+ Shoulda Matchers is [tested][travis] and supported against Ruby 2.4+, Rails
474
+ 4.2+, RSpec 3.x, and Minitest 5.x.
475
+
476
+ For Ruby < 2.4 and Rails < 4.1 compatibility, please use [v3.1.3][v3.1.3].
477
+
478
+ [v3.1.3]: https://github.com/thoughtbot/shoulda-matchers/tree/v3.1.3
401
479
 
402
480
  ## Versioning
403
481
 
404
482
  Shoulda Matchers follows Semantic Versioning 2.0 as defined at
405
483
  <http://semver.org>.
406
484
 
407
- ## License
485
+ ## Team
486
+
487
+ Shoulda Matchers is maintained by [Elliot Winkler][mcmire] and [Gui
488
+ Albuk][guialbuk].
489
+
490
+ [mcmire]: https://github.com/mcmire
491
+ [guialbuk]: https://github.com/guialbuk
492
+
493
+ ## Copyright/License
408
494
 
409
- Shoulda Matchers is copyright © 2006-2019
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.
495
+ Shoulda Matchers is copyright © 2006-2020 Tammer Saleh and [thoughtbot,
496
+ inc][thoughtbot-website]. It is free and opensource software and may be
497
+ redistributed under the terms specified in the [LICENSE](LICENSE) file.
413
498
 
414
499
  [thoughtbot-website]: https://thoughtbot.com
415
500
 
@@ -419,8 +504,7 @@ and may be redistributed under the terms specified in the
419
504
 
420
505
  [thoughtbot-logo]: https://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg
421
506
 
422
- Shoulda Matchers is maintained and funded by thoughtbot, inc. The names and
423
- logos for thoughtbot are trademarks of thoughtbot, inc.
507
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
424
508
 
425
509
  We are passionate about open source software. See [our other
426
510
  projects][community]. We are [available for hire][hire].
@@ -1,21 +1,22 @@
1
1
  require 'shoulda/matchers/configuration'
2
- require 'shoulda/matchers/doublespeak'
3
- require 'shoulda/matchers/error'
4
- require 'shoulda/matchers/independent'
5
- require 'shoulda/matchers/integrations'
6
- require 'shoulda/matchers/matcher_context'
7
- require 'shoulda/matchers/rails_shim'
8
- require 'shoulda/matchers/util'
9
2
  require 'shoulda/matchers/version'
10
3
  require 'shoulda/matchers/warn'
11
4
 
12
- require 'shoulda/matchers/action_controller'
13
- require 'shoulda/matchers/active_model'
14
- require 'shoulda/matchers/active_record'
15
- require 'shoulda/matchers/routing'
16
-
17
5
  module Shoulda
18
6
  module Matchers
7
+ autoload :ActionController, 'shoulda/matchers/action_controller'
8
+ autoload :ActiveModel, 'shoulda/matchers/active_model'
9
+ autoload :ActiveRecord, 'shoulda/matchers/active_record'
10
+ autoload :Doublespeak, 'shoulda/matchers/doublespeak'
11
+ autoload :Error, 'shoulda/matchers/error'
12
+ autoload :Independent, 'shoulda/matchers/independent'
13
+ autoload :Integrations, 'shoulda/matchers/integrations'
14
+ autoload :MatcherContext, 'shoulda/matchers/matcher_context'
15
+ autoload :RailsShim, 'shoulda/matchers/rails_shim'
16
+ autoload :Routing, 'shoulda/matchers/routing'
17
+ autoload :Util, 'shoulda/matchers/util'
18
+ autoload :WordWrap, 'shoulda/matchers/util/word_wrap'
19
+
19
20
  class << self
20
21
  # @private
21
22
  attr_accessor :assertion_exception_class