shoulda-matchers 4.1.1 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +163 -79
  3. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +2 -2
  4. data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +5 -1
  5. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +1 -1
  6. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +2 -21
  7. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +27 -3
  8. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +32 -0
  9. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +6 -9
  10. data/lib/shoulda/matchers/active_model/validation_matcher.rb +25 -0
  11. data/lib/shoulda/matchers/active_record.rb +3 -0
  12. data/lib/shoulda/matchers/active_record/association_matcher.rb +23 -7
  13. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +2 -2
  14. data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +12 -6
  15. data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +20 -3
  16. data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +147 -0
  17. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +1 -1
  18. data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
  19. data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +79 -0
  20. data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +28 -9
  21. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +2 -6
  22. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +2 -2
  23. data/lib/shoulda/matchers/independent.rb +0 -1
  24. data/lib/shoulda/matchers/rails_shim.rb +42 -44
  25. data/lib/shoulda/matchers/util.rb +9 -2
  26. data/lib/shoulda/matchers/util/word_wrap.rb +1 -1
  27. data/lib/shoulda/matchers/version.rb +1 -1
  28. metadata +9 -8
  29. data/MIT-LICENSE +0 -22
  30. 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: f55ad44dc8280d7bb9598c809562c5d4b4bd174e78bdc8323898bdb7a3e8665a
4
- data.tar.gz: 80ddb4b8e6c0ab63c4b9225a1a75789d058d1e664c1b2248680469868072e724
3
+ metadata.gz: 4f12034724c2954cf58fc7e89723ce42119e3a6f39676899c0510545a61f5fee
4
+ data.tar.gz: 0c5cd62168c0dd00fa3246c9afe2ee4499db8c37312ff6f0f8ee10afb16f0f42
5
5
  SHA512:
6
- metadata.gz: b912596ee8e4a25b1cbd98bca2878ac52cc19b54ab6014bbff0952b7449294e26a6d82b21a6d871b897eb23b26fb82bbc7b328d4de28bb73191fccf53e4e9c1b
7
- data.tar.gz: 168c002e0ed67d1a2dfde0465e2f48c2fcd4177810479f9c4d5970949f4fbec7db7cb5c71c33b7a341174d5c97fbbfb0782b18ada9f30695048bf25c64777875
6
+ metadata.gz: 3e33ed5061a6913d3b448f2f251e79a7618c9226275a308bf5a0547a81dddb4fbaf17a8834ddf3a1e3662cc712afaf6994bb9ea44a727adcdffbd41653ced13c
7
+ data.tar.gz: e7ca6969c599eeb2fa8a084a4486085b6156760d0a77a1466d3989c0a9f15b7b092d7cdb7f4e2bbdf1befd5437afbd69121316e2ba6d9b271c809e3abfad82d1
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.1)][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].
@@ -41,7 +41,7 @@ module Shoulda
41
41
  # end
42
42
  #
43
43
  # it do
44
- # should_not allow_values('http://foo.com', 'buz').
44
+ # should_not allow_values('foo', 'buz').
45
45
  # for(:website_url)
46
46
  # end
47
47
  # end
@@ -51,7 +51,7 @@ module Shoulda
51
51
  # should allow_values('http://foo.com', 'http://bar.com/baz').
52
52
  # for(:website_url)
53
53
  #
54
- # should_not allow_values('http://foo.com', 'buz').
54
+ # should_not allow_values('foo', 'buz').
55
55
  # for(:website_url)
56
56
  # end
57
57
  #
@@ -9,7 +9,8 @@ module Shoulda
9
9
  :>= => :greater_than_or_equal_to,
10
10
  :< => :less_than,
11
11
  :<= => :less_than_or_equal_to,
12
- :== => :equal_to
12
+ :== => :equal_to,
13
+ :!= => :other_than,
13
14
  }
14
15
 
15
16
  def initialize(numericality_matcher, value, operator)
@@ -125,6 +126,8 @@ module Shoulda
125
126
  [true, false, false]
126
127
  when :<=
127
128
  [true, true, false]
129
+ when :!=
130
+ [true, false, true]
128
131
  end
129
132
  end
130
133
 
@@ -146,6 +149,7 @@ module Shoulda
146
149
  when :== then "equal to"
147
150
  when :< then "less than"
148
151
  when :<= then "less than or equal to"
152
+ when :!= then 'other than'
149
153
  end
150
154
  end
151
155
  end