shoulda-matchers 4.1.1 → 4.4.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.
- checksums.yaml +4 -4
- data/README.md +163 -79
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +5 -1
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +2 -21
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +27 -3
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +32 -0
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +6 -9
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +25 -0
- data/lib/shoulda/matchers/active_record.rb +3 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +23 -7
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +12 -6
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +20 -3
- data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +147 -0
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
- data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +79 -0
- data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +28 -9
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +2 -6
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +2 -2
- data/lib/shoulda/matchers/independent.rb +0 -1
- data/lib/shoulda/matchers/rails_shim.rb +42 -44
- data/lib/shoulda/matchers/util.rb +9 -2
- data/lib/shoulda/matchers/util/word_wrap.rb +1 -1
- data/lib/shoulda/matchers/version.rb +1 -1
- metadata +9 -8
- data/MIT-LICENSE +0 -22
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f12034724c2954cf58fc7e89723ce42119e3a6f39676899c0510545a61f5fee
|
4
|
+
data.tar.gz: 0c5cd62168c0dd00fa3246c9afe2ee4499db8c37312ff6f0f8ee10afb16f0f42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
23
|
-
📢 **[See what's changed in
|
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
|
-
[
|
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
|
-
* [
|
44
|
+
* [Extensions](#extensions)
|
43
45
|
* [Contributing](#contributing)
|
46
|
+
* [Compatibility](#compatibility)
|
44
47
|
* [Versioning](#versioning)
|
45
|
-
* [
|
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
|
-
|
64
|
+
Then run `bundle install`.
|
61
65
|
|
62
|
-
|
63
|
-
* Which portion of the matchers you want to use
|
66
|
+
Now you need to configure the gem by telling it:
|
64
67
|
|
65
|
-
|
66
|
-
|
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
|
-
|
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
|
87
|
-
ActiveModel, you can still use this gem too! In that case,
|
88
|
-
the following configuration at the bottom of
|
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
|
-
|
107
|
-
|
108
|
-
|
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
|
-
[
|
111
|
-
[shoulda-context]: https://github.com/thoughtbot/shoulda-context
|
116
|
+
[Shoulda]: https://github.com/thoughtbot/shoulda
|
112
117
|
|
113
|
-
|
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', '~>
|
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
|
-
|
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
|
-
|
129
|
-
|
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
|
-
* [
|
177
|
+
* [Rails-specific features like `delegate`](#independent-matchers)
|
137
178
|
|
138
|
-
|
139
|
-
|
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
|
-
|
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
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
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
|
237
|
-
|
238
|
-
|
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
|
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
|
-
**
|
255
|
-
you want to use model matchers in certain example
|
256
|
-
manually include the module that holds those matchers
|
257
|
-
|
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
|
-
|
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,
|
277
|
-
of RSpec's one-liner syntax over `is_expected.to`.
|
278
|
-
|
279
|
-
|
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
|
-
|
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
|
-
##
|
453
|
+
## Extensions
|
383
454
|
|
384
|
-
|
385
|
-
|
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
|
-
|
458
|
+
* **[shoulda-matchers-cucumber]** – Adds support for using Shoulda Matchers in
|
459
|
+
Cucumber tests.
|
388
460
|
|
389
|
-
[
|
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
|
-
|
394
|
-
|
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
|
-
|
471
|
+
## Compatibility
|
397
472
|
|
398
|
-
|
399
|
-
|
400
|
-
|
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
|
-
##
|
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-
|
410
|
-
|
411
|
-
|
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
|
-
|
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('
|
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('
|
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
|