shoulda-matchers 3.0.0.rc1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -3
  3. data/Gemfile.lock +12 -41
  4. data/NEWS.md +118 -26
  5. data/README.md +34 -11
  6. data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -0
  7. data/doc_config/yard/templates/default/fulldoc/html/css/style.css +4 -0
  8. data/gemfiles/4.0.0.gemfile +2 -3
  9. data/gemfiles/4.0.0.gemfile.lock +47 -77
  10. data/gemfiles/4.0.1.gemfile +2 -3
  11. data/gemfiles/4.0.1.gemfile.lock +51 -79
  12. data/gemfiles/4.1.gemfile +2 -3
  13. data/gemfiles/4.1.gemfile.lock +73 -103
  14. data/gemfiles/4.2.gemfile +2 -3
  15. data/gemfiles/4.2.gemfile.lock +90 -124
  16. data/lib/shoulda/matchers.rb +1 -0
  17. data/lib/shoulda/matchers/action_controller/callback_matcher.rb +6 -8
  18. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +1 -3
  19. data/lib/shoulda/matchers/action_controller/flash_store.rb +1 -8
  20. data/lib/shoulda/matchers/action_controller/permit_matcher.rb +140 -88
  21. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +2 -5
  22. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +5 -10
  23. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +2 -4
  24. data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +1 -3
  25. data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +3 -5
  26. data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -7
  27. data/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +35 -9
  28. data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -3
  29. data/lib/shoulda/matchers/active_model.rb +57 -1
  30. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +2 -5
  31. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +162 -54
  32. data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +5 -2
  33. data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +1 -3
  34. data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +24 -11
  35. data/lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb +4 -3
  36. data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +0 -2
  37. data/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb +4 -3
  38. data/lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb +2 -1
  39. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +15 -13
  40. data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +3 -3
  41. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +3 -3
  42. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +4 -4
  43. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +8 -8
  44. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +8 -8
  45. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +12 -14
  46. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +10 -4
  47. data/lib/shoulda/matchers/active_model/validation_matcher.rb +0 -3
  48. data/lib/shoulda/matchers/active_model/validator.rb +0 -8
  49. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +4 -6
  50. data/lib/shoulda/matchers/active_record/association_matcher.rb +58 -43
  51. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +2 -2
  52. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +3 -5
  53. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +3 -5
  54. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +1 -4
  55. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +3 -5
  56. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +7 -7
  57. data/lib/shoulda/matchers/doublespeak/double.rb +10 -1
  58. data/lib/shoulda/matchers/doublespeak/double_collection.rb +13 -5
  59. data/lib/shoulda/matchers/doublespeak/method_call.rb +10 -1
  60. data/lib/shoulda/matchers/doublespeak/object_double.rb +2 -1
  61. data/lib/shoulda/matchers/doublespeak/world.rb +10 -0
  62. data/lib/shoulda/matchers/error.rb +4 -0
  63. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +11 -10
  64. data/lib/shoulda/matchers/integrations/libraries.rb +1 -0
  65. data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
  66. data/lib/shoulda/matchers/integrations/libraries/active_model.rb +1 -1
  67. data/lib/shoulda/matchers/integrations/libraries/active_record.rb +1 -1
  68. data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -1
  69. data/lib/shoulda/matchers/integrations/libraries/routing.rb +27 -0
  70. data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
  71. data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
  72. data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
  73. data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
  74. data/lib/shoulda/matchers/integrations/test_frameworks/rspec.rb +2 -2
  75. data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
  76. data/lib/shoulda/matchers/routing.rb +10 -0
  77. data/lib/shoulda/matchers/version.rb +1 -1
  78. data/script/SUPPORTED_VERSIONS +1 -1
  79. data/spec/acceptance/independent_matchers_spec.rb +103 -42
  80. data/spec/doublespeak_spec_helper.rb +5 -1
  81. data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +34 -11
  82. data/spec/support/acceptance/helpers/rspec_helpers.rb +9 -13
  83. data/spec/support/acceptance/helpers/step_helpers.rb +13 -0
  84. data/spec/support/acceptance/matchers/have_output.rb +1 -1
  85. data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +1 -1
  86. data/spec/support/tests/command_runner.rb +5 -1
  87. data/spec/support/unit/helpers/active_record_versions.rb +0 -4
  88. data/spec/support/unit/shared_examples/set_session_or_flash.rb +8 -3
  89. data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +198 -39
  90. data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +269 -102
  91. data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +24 -0
  92. data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +118 -101
  93. data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -82
  94. data/spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +148 -121
  95. data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +20 -8
  96. data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +64 -183
  97. data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +14 -0
  98. data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +60 -0
  99. data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +23 -7
  100. data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +242 -0
  101. data/spec/unit_spec_helper.rb +4 -0
  102. data/tasks/documentation.rb +35 -0
  103. metadata +9 -8
  104. data/Guardfile +0 -5
  105. data/cucumber.yml +0 -1
  106. data/lib/shoulda/matchers/active_model/validator_with_captured_range_error.rb +0 -12
@@ -16,7 +16,7 @@ module Shoulda
16
16
  # it { should validate_numericality_of(:gpa) }
17
17
  # end
18
18
  #
19
- # # Test::Unit
19
+ # # Minitest (Shoulda)
20
20
  # class PersonTest < ActiveSupport::TestCase
21
21
  # should validate_numericality_of(:gpa)
22
22
  # end
@@ -42,7 +42,7 @@ module Shoulda
42
42
  # end
43
43
  # end
44
44
  #
45
- # # Test::Unit
45
+ # # Minitest (Shoulda)
46
46
  # class PersonTest < ActiveSupport::TestCase
47
47
  # should validate_numericality_of(:number_of_dependents).on(:create)
48
48
  # end
@@ -65,7 +65,7 @@ module Shoulda
65
65
  # it { should validate_numericality_of(:age).only_integer }
66
66
  # end
67
67
  #
68
- # # Test::Unit
68
+ # # Minitest (Shoulda)
69
69
  # class PersonTest < ActiveSupport::TestCase
70
70
  # should validate_numericality_of(:age).only_integer
71
71
  # end
@@ -92,7 +92,7 @@ module Shoulda
92
92
  # end
93
93
  # end
94
94
  #
95
- # # Test::Unit
95
+ # # Minitest (Shoulda)
96
96
  # class PersonTest < ActiveSupport::TestCase
97
97
  # should validate_numericality_of(:number_of_cars).
98
98
  # is_less_than(2)
@@ -120,7 +120,7 @@ module Shoulda
120
120
  # end
121
121
  # end
122
122
  #
123
- # # Test::Unit
123
+ # # Minitest (Shoulda)
124
124
  # class PersonTest < ActiveSupport::TestCase
125
125
  # should validate_numericality_of(:birth_year).
126
126
  # is_less_than_or_equal_to(1987)
@@ -144,7 +144,7 @@ module Shoulda
144
144
  # it { should validate_numericality_of(:weight).is_equal_to(150) }
145
145
  # end
146
146
  #
147
- # # Test::Unit
147
+ # # Minitest (Shoulda)
148
148
  # class PersonTest < ActiveSupport::TestCase
149
149
  # should validate_numericality_of(:weight).is_equal_to(150)
150
150
  # end
@@ -171,7 +171,7 @@ module Shoulda
171
171
  # end
172
172
  # end
173
173
  #
174
- # # Test::Unit
174
+ # # Minitest (Shoulda)
175
175
  # class PersonTest < ActiveSupport::TestCase
176
176
  # should validate_numericality_of(:height).
177
177
  # is_greater_than_or_equal_to(55)
@@ -198,7 +198,7 @@ module Shoulda
198
198
  # end
199
199
  # end
200
200
  #
201
- # # Test::Unit
201
+ # # Minitest (Shoulda)
202
202
  # class PersonTest < ActiveSupport::TestCase
203
203
  # should validate_numericality_of(:legal_age).
204
204
  # is_greater_than(21)
@@ -221,7 +221,7 @@ module Shoulda
221
221
  # it { should validate_numericality_of(:birth_month).even }
222
222
  # end
223
223
  #
224
- # # Test::Unit
224
+ # # Minitest (Shoulda)
225
225
  # class PersonTest < ActiveSupport::TestCase
226
226
  # should validate_numericality_of(:birth_month).even
227
227
  # end
@@ -244,7 +244,7 @@ module Shoulda
244
244
  # it { should validate_numericality_of(:birth_day).odd }
245
245
  # end
246
246
  #
247
- # # Test::Unit
247
+ # # Minitest (Shoulda)
248
248
  # class PersonTest < ActiveSupport::TestCase
249
249
  # should validate_numericality_of(:birth_day).odd
250
250
  # end
@@ -269,7 +269,7 @@ module Shoulda
269
269
  # end
270
270
  # end
271
271
  #
272
- # # Test::Unit
272
+ # # Minitest (Shoulda)
273
273
  # class PersonTest < ActiveSupport::TestCase
274
274
  # should validate_numericality_of(:number_of_dependents).
275
275
  # with_message('Number of dependents must be a number')
@@ -291,7 +291,7 @@ module Shoulda
291
291
  # it { should validate_numericality_of(:age).allow_nil }
292
292
  # end
293
293
  #
294
- # # Test::Unit
294
+ # # Minitest (Shoulda)
295
295
  # class PostTest < ActiveSupport::TestCase
296
296
  # should validate_numericality_of(:age).allow_nil
297
297
  # end
@@ -412,12 +412,10 @@ module Shoulda
412
412
  def failure_message
413
413
  first_failing_submatcher.failure_message
414
414
  end
415
- alias failure_message_for_should failure_message
416
415
 
417
416
  def failure_message_when_negated
418
417
  first_failing_submatcher.failure_message_when_negated
419
418
  end
420
- alias failure_message_for_should_not failure_message_when_negated
421
419
 
422
420
  private
423
421
 
@@ -16,7 +16,7 @@ module Shoulda
16
16
  # it { should validate_presence_of(:arms) }
17
17
  # end
18
18
  #
19
- # # Test::Unit
19
+ # # Minitest (Shoulda)
20
20
  # class RobotTest < ActiveSupport::TestCase
21
21
  # should validate_presence_of(:arms)
22
22
  # end
@@ -73,7 +73,7 @@ module Shoulda
73
73
  # it { should validate_presence_of(:arms).on(:create) }
74
74
  # end
75
75
  #
76
- # # Test::Unit
76
+ # # Minitest (Shoulda)
77
77
  # class RobotTest < ActiveSupport::TestCase
78
78
  # should validate_presence_of(:arms).on(:create)
79
79
  # end
@@ -97,7 +97,7 @@ module Shoulda
97
97
  # end
98
98
  # end
99
99
  #
100
- # # Test::Unit
100
+ # # Minitest (Shoulda)
101
101
  # class RobotTest < ActiveSupport::TestCase
102
102
  # should validate_presence_of(:legs).
103
103
  # with_message('Robot has no legs')
@@ -123,7 +123,7 @@ module Shoulda
123
123
  if secure_password_being_validated?
124
124
  disallows_and_double_checks_value_of!(blank_value, @expected_message)
125
125
  else
126
- disallows_value_of(blank_value, @expected_message)
126
+ disallows_original_or_typecast_value?(blank_value, @expected_message)
127
127
  end
128
128
  end
129
129
 
@@ -145,6 +145,12 @@ module Shoulda
145
145
  raise ActiveModel::CouldNotSetPasswordError.create(@subject.class)
146
146
  end
147
147
 
148
+ def disallows_original_or_typecast_value?(value, message)
149
+ disallows_value_of(blank_value, @expected_message)
150
+ rescue ActiveModel::AllowValueMatcher::CouldNotSetAttributeError => error
151
+ error.actual_value.blank?
152
+ end
153
+
148
154
  def blank_value
149
155
  if collection?
150
156
  []
@@ -5,8 +5,6 @@ module Shoulda
5
5
  class ValidationMatcher
6
6
  attr_reader :failure_message
7
7
 
8
- alias failure_message_for_should failure_message
9
-
10
8
  def initialize(attribute)
11
9
  @attribute = attribute
12
10
  @strict = false
@@ -27,7 +25,6 @@ module Shoulda
27
25
  def failure_message_when_negated
28
26
  @failure_message_when_negated || @failure_message
29
27
  end
30
- alias failure_message_for_should_not failure_message_when_negated
31
28
 
32
29
  def matches?(subject)
33
30
  @subject = subject
@@ -23,11 +23,6 @@ module Shoulda
23
23
  end
24
24
  end
25
25
 
26
- def capture_range_error(exception)
27
- @captured_range_error = exception
28
- extend ValidatorWithCapturedRangeError
29
- end
30
-
31
26
  def allow_description(allowed_values)
32
27
  "allow #{attribute} to be set to #{allowed_values}"
33
28
  end
@@ -85,9 +80,6 @@ module Shoulda
85
80
 
86
81
  def collect_errors_or_exceptions
87
82
  collect_messages
88
- rescue RangeError => exception
89
- capture_range_error(exception)
90
- []
91
83
  end
92
84
 
93
85
  def validation_errors
@@ -13,7 +13,7 @@ module Shoulda
13
13
  # it { should accept_nested_attributes_for(:doors) }
14
14
  # end
15
15
  #
16
- # # Test::Unit (using Shoulda)
16
+ # # Minitest (Shoulda) (using Shoulda)
17
17
  # class CarTest < ActiveSupport::TestCase
18
18
  # should accept_nested_attributes_for(:doors)
19
19
  # end
@@ -37,7 +37,7 @@ module Shoulda
37
37
  # end
38
38
  # end
39
39
  #
40
- # # Test::Unit
40
+ # # Minitest (Shoulda)
41
41
  # class CarTest < ActiveSupport::TestCase
42
42
  # should accept_nested_attributes_for(:mirrors).
43
43
  # allow_destroy(true)
@@ -59,7 +59,7 @@ module Shoulda
59
59
  # end
60
60
  # end
61
61
  #
62
- # # Test::Unit
62
+ # # Minitest (Shoulda)
63
63
  # class CarTest < ActiveSupport::TestCase
64
64
  # should accept_nested_attributes_for(:windows).
65
65
  # limit(3)
@@ -82,7 +82,7 @@ module Shoulda
82
82
  # end
83
83
  # end
84
84
  #
85
- # # Test::Unit
85
+ # # Minitest (Shoulda)
86
86
  # class CarTest < ActiveSupport::TestCase
87
87
  # should accept_nested_attributes_for(:engine).
88
88
  # update_only(true)
@@ -127,12 +127,10 @@ module Shoulda
127
127
  def failure_message
128
128
  "Expected #{expectation} (#{@problem})"
129
129
  end
130
- alias failure_message_for_should failure_message
131
130
 
132
131
  def failure_message_when_negated
133
132
  "Did not expect #{expectation}"
134
133
  end
135
- alias failure_message_for_should_not failure_message_when_negated
136
134
 
137
135
  def description
138
136
  description = "accepts_nested_attributes_for :#{@name}"
@@ -15,7 +15,7 @@ module Shoulda
15
15
  # it { should belong_to(:organization) }
16
16
  # end
17
17
  #
18
- # # Test::Unit
18
+ # # Minitest (Shoulda)
19
19
  # class PersonTest < ActiveSupport::TestCase
20
20
  # should belong_to(:organization)
21
21
  # end
@@ -32,7 +32,7 @@ module Shoulda
32
32
  # it { should belong_to(:commentable) }
33
33
  # end
34
34
  #
35
- # # Test::Unit
35
+ # # Minitest (Shoulda)
36
36
  # class CommentTest < ActiveSupport::TestCase
37
37
  # should belong_to(:commentable)
38
38
  # end
@@ -56,7 +56,7 @@ module Shoulda
56
56
  # end
57
57
  # end
58
58
  #
59
- # # Test::Unit
59
+ # # Minitest (Shoulda)
60
60
  # class PersonTest < ActiveSupport::TestCase
61
61
  # should belong_to(:family).
62
62
  # conditions(everyone_is_perfect: false)
@@ -76,7 +76,7 @@ module Shoulda
76
76
  # it { should belong_to(:previous_company).order('hired_on desc') }
77
77
  # end
78
78
  #
79
- # # Test::Unit
79
+ # # Minitest (Shoulda)
80
80
  # class PersonTest < ActiveSupport::TestCase
81
81
  # should belong_to(:previous_company).order('hired_on desc')
82
82
  # end
@@ -95,7 +95,7 @@ module Shoulda
95
95
  # it { should belong_to(:ancient_city).class_name('City') }
96
96
  # end
97
97
  #
98
- # # Test::Unit
98
+ # # Minitest (Shoulda)
99
99
  # class PersonTest < ActiveSupport::TestCase
100
100
  # should belong_to(:ancient_city).class_name('City')
101
101
  # end
@@ -116,7 +116,7 @@ module Shoulda
116
116
  # end
117
117
  # end
118
118
  #
119
- # # Test::Unit
119
+ # # Minitest (Shoulda)
120
120
  # class PersonTest < ActiveSupport::TestCase
121
121
  # should belong_to(:great_country).
122
122
  # with_primary_key('country_id')
@@ -138,7 +138,7 @@ module Shoulda
138
138
  # end
139
139
  # end
140
140
  #
141
- # # Test::Unit
141
+ # # Minitest (Shoulda)
142
142
  # class PersonTest < ActiveSupport::TestCase
143
143
  # should belong_to(:great_country).
144
144
  # with_foreign_key('country_id')
@@ -157,7 +157,7 @@ module Shoulda
157
157
  # it { should belong_to(:world).dependent(:destroy) }
158
158
  # end
159
159
  #
160
- # # Test::Unit
160
+ # # Minitest (Shoulda)
161
161
  # class PersonTest < ActiveSupport::TestCase
162
162
  # should belong_to(:world).dependent(:destroy)
163
163
  # end
@@ -194,7 +194,7 @@ module Shoulda
194
194
  # it { should belong_to(:organization).counter_cache(true) }
195
195
  # end
196
196
  #
197
- # # Test::Unit
197
+ # # Minitest (Shoulda)
198
198
  # class PersonTest < ActiveSupport::TestCase
199
199
  # should belong_to(:organization).counter_cache(true)
200
200
  # end
@@ -212,7 +212,7 @@ module Shoulda
212
212
  # it { should belong_to(:organization).touch(true) }
213
213
  # end
214
214
  #
215
- # # Test::Unit
215
+ # # Minitest (Shoulda)
216
216
  # class PersonTest < ActiveSupport::TestCase
217
217
  # should belong_to(:organization).touch(true)
218
218
  # end
@@ -230,7 +230,7 @@ module Shoulda
230
230
  # it { should belong_to(:bank).autosave(true) }
231
231
  # end
232
232
  #
233
- # # Test::Unit
233
+ # # Minitest (Shoulda)
234
234
  # class AccountTest < ActiveSupport::TestCase
235
235
  # should belong_to(:bank).autosave(true)
236
236
  # end
@@ -248,7 +248,7 @@ module Shoulda
248
248
  # it { should belong_to(:organization).inverse_of(:employees) }
249
249
  # end
250
250
  #
251
- # # Test::Unit
251
+ # # Minitest (Shoulda)
252
252
  # class PersonTest < ActiveSupport::TestCase
253
253
  # should belong_to(:organization).inverse_of(:employees)
254
254
  # end
@@ -271,11 +271,28 @@ module Shoulda
271
271
  # it { should have_many(:friends) }
272
272
  # end
273
273
  #
274
- # # Test::Unit
274
+ # # Minitest (Shoulda)
275
275
  # class PersonTest < ActiveSupport::TestCase
276
276
  # should have_many(:friends)
277
277
  # end
278
278
  #
279
+ # Note that polymorphic associations are automatically detected and do not
280
+ # need any qualifiers:
281
+ #
282
+ # class Person < ActiveRecord::Base
283
+ # has_many :pictures, as: :imageable
284
+ # end
285
+ #
286
+ # # RSpec
287
+ # describe Person do
288
+ # it { should have_many(:pictures) }
289
+ # end
290
+ #
291
+ # # Minitest (Shoulda)
292
+ # class PersonTest < ActiveSupport::TestCase
293
+ # should have_many(:pictures)
294
+ # end
295
+ #
279
296
  # #### Qualifiers
280
297
  #
281
298
  # ##### conditions
@@ -292,7 +309,7 @@ module Shoulda
292
309
  # it { should have_many(:coins).conditions(quality: 'mint') }
293
310
  # end
294
311
  #
295
- # # Test::Unit
312
+ # # Minitest (Shoulda)
296
313
  # class PersonTest < ActiveSupport::TestCase
297
314
  # should have_many(:coins).conditions(quality: 'mint')
298
315
  # end
@@ -311,7 +328,7 @@ module Shoulda
311
328
  # it { should have_many(:shirts).order('color') }
312
329
  # end
313
330
  #
314
- # # Test::Unit
331
+ # # Minitest (Shoulda)
315
332
  # class PersonTest < ActiveSupport::TestCase
316
333
  # should have_many(:shirts).order('color')
317
334
  # end
@@ -330,7 +347,7 @@ module Shoulda
330
347
  # it { should have_many(:hopes).class_name('Dream') }
331
348
  # end
332
349
  #
333
- # # Test::Unit
350
+ # # Minitest (Shoulda)
334
351
  # class PersonTest < ActiveSupport::TestCase
335
352
  # should have_many(:hopes).class_name('Dream')
336
353
  # end
@@ -348,7 +365,7 @@ module Shoulda
348
365
  # it { should have_many(:worries).with_primary_key('worrier_id') }
349
366
  # end
350
367
  #
351
- # # Test::Unit
368
+ # # Minitest (Shoulda)
352
369
  # class PersonTest < ActiveSupport::TestCase
353
370
  # should have_many(:worries).with_primary_key('worrier_id')
354
371
  # end
@@ -366,7 +383,7 @@ module Shoulda
366
383
  # it { should have_many(:worries).with_foreign_key('worrier_id') }
367
384
  # end
368
385
  #
369
- # # Test::Unit
386
+ # # Minitest (Shoulda)
370
387
  # class PersonTest < ActiveSupport::TestCase
371
388
  # should have_many(:worries).with_foreign_key('worrier_id')
372
389
  # end
@@ -384,7 +401,7 @@ module Shoulda
384
401
  # it { should have_many(:secret_documents).dependent(:destroy) }
385
402
  # end
386
403
  #
387
- # # Test::Unit
404
+ # # Minitest (Shoulda)
388
405
  # class PersonTest < ActiveSupport::TestCase
389
406
  # should have_many(:secret_documents).dependent(:destroy)
390
407
  # end
@@ -403,7 +420,7 @@ module Shoulda
403
420
  # it { should have_many(:acquaintances).through(:friends) }
404
421
  # end
405
422
  #
406
- # # Test::Unit
423
+ # # Minitest (Shoulda)
407
424
  # class PersonTest < ActiveSupport::TestCase
408
425
  # should have_many(:acquaintances).through(:friends)
409
426
  # end
@@ -426,7 +443,7 @@ module Shoulda
426
443
  # end
427
444
  # end
428
445
  #
429
- # # Test::Unit
446
+ # # Minitest (Shoulda)
430
447
  # class PersonTest < ActiveSupport::TestCase
431
448
  # should have_many(:job_offers).
432
449
  # through(:friends).
@@ -446,7 +463,7 @@ module Shoulda
446
463
  # it { should have_many(:ideas).validate(false) }
447
464
  # end
448
465
  #
449
- # # Test::Unit
466
+ # # Minitest (Shoulda)
450
467
  # class PersonTest < ActiveSupport::TestCase
451
468
  # should have_many(:ideas).validate(false)
452
469
  # end
@@ -464,7 +481,7 @@ module Shoulda
464
481
  # it { should have_many(:games).autosave(true) }
465
482
  # end
466
483
  #
467
- # # Test::Unit
484
+ # # Minitest (Shoulda)
468
485
  # class PlayerTest < ActiveSupport::TestCase
469
486
  # should have_many(:games).autosave(true)
470
487
  # end
@@ -487,7 +504,7 @@ module Shoulda
487
504
  # it { should have_one(:partner) }
488
505
  # end
489
506
  #
490
- # # Test::Unit
507
+ # # Minitest (Shoulda)
491
508
  # class PersonTest < ActiveSupport::TestCase
492
509
  # should have_one(:partner)
493
510
  # end
@@ -508,7 +525,7 @@ module Shoulda
508
525
  # it { should have_one(:pet).conditions('weight < 80') }
509
526
  # end
510
527
  #
511
- # # Test::Unit
528
+ # # Minitest (Shoulda)
512
529
  # class PersonTest < ActiveSupport::TestCase
513
530
  # should have_one(:pet).conditions('weight < 80')
514
531
  # end
@@ -527,7 +544,7 @@ module Shoulda
527
544
  # it { should have_one(:focus).order('priority desc') }
528
545
  # end
529
546
  #
530
- # # Test::Unit
547
+ # # Minitest (Shoulda)
531
548
  # class PersonTest < ActiveSupport::TestCase
532
549
  # should have_one(:focus).order('priority desc')
533
550
  # end
@@ -546,7 +563,7 @@ module Shoulda
546
563
  # it { should have_one(:chance).class_name('Opportunity') }
547
564
  # end
548
565
  #
549
- # # Test::Unit
566
+ # # Minitest (Shoulda)
550
567
  # class PersonTest < ActiveSupport::TestCase
551
568
  # should have_one(:chance).class_name('Opportunity')
552
569
  # end
@@ -564,7 +581,7 @@ module Shoulda
564
581
  # it { should have_one(:contract).dependent(:nullify) }
565
582
  # end
566
583
  #
567
- # # Test::Unit
584
+ # # Minitest (Shoulda)
568
585
  # class PersonTest < ActiveSupport::TestCase
569
586
  # should have_one(:contract).dependent(:nullify)
570
587
  # end
@@ -582,7 +599,7 @@ module Shoulda
582
599
  # it { should have_one(:job).with_primary_key('worker_id') }
583
600
  # end
584
601
  #
585
- # # Test::Unit
602
+ # # Minitest (Shoulda)
586
603
  # class PersonTest < ActiveSupport::TestCase
587
604
  # should have_one(:job).with_primary_key('worker_id')
588
605
  # end
@@ -600,7 +617,7 @@ module Shoulda
600
617
  # it { should have_one(:job).with_foreign_key('worker_id') }
601
618
  # end
602
619
  #
603
- # # Test::Unit
620
+ # # Minitest (Shoulda)
604
621
  # class PersonTest < ActiveSupport::TestCase
605
622
  # should have_one(:job).with_foreign_key('worker_id')
606
623
  # end
@@ -619,7 +636,7 @@ module Shoulda
619
636
  # it { should have_one(:life).through(:partner) }
620
637
  # end
621
638
  #
622
- # # Test::Unit
639
+ # # Minitest (Shoulda)
623
640
  # class PersonTest < ActiveSupport::TestCase
624
641
  # should have_one(:life).through(:partner)
625
642
  # end
@@ -638,7 +655,7 @@ module Shoulda
638
655
  # it { should have_one(:car).through(:partner).source(:vehicle) }
639
656
  # end
640
657
  #
641
- # # Test::Unit
658
+ # # Minitest (Shoulda)
642
659
  # class PersonTest < ActiveSupport::TestCase
643
660
  # should have_one(:car).through(:partner).source(:vehicle)
644
661
  # end
@@ -656,7 +673,7 @@ module Shoulda
656
673
  # it { should have_one(:parking_card).validate(false) }
657
674
  # end
658
675
  #
659
- # # Test::Unit
676
+ # # Minitest (Shoulda)
660
677
  # class PersonTest < ActiveSupport::TestCase
661
678
  # should have_one(:parking_card).validate(false)
662
679
  # end
@@ -674,7 +691,7 @@ module Shoulda
674
691
  # it { should have_one(:bank).autosave(true) }
675
692
  # end
676
693
  #
677
- # # Test::Unit
694
+ # # Minitest (Shoulda)
678
695
  # class AccountTest < ActiveSupport::TestCase
679
696
  # should have_one(:bank).autosave(true)
680
697
  # end
@@ -698,7 +715,7 @@ module Shoulda
698
715
  # it { should have_and_belong_to_many(:awards) }
699
716
  # end
700
717
  #
701
- # # Test::Unit
718
+ # # Minitest (Shoulda)
702
719
  # class PersonTest < ActiveSupport::TestCase
703
720
  # should have_and_belong_to_many(:awards)
704
721
  # end
@@ -722,7 +739,7 @@ module Shoulda
722
739
  # end
723
740
  # end
724
741
  #
725
- # # Test::Unit
742
+ # # Minitest (Shoulda)
726
743
  # class PersonTest < ActiveSupport::TestCase
727
744
  # should have_and_belong_to_many(:issues).
728
745
  # conditions(difficulty: 'hard')
@@ -745,7 +762,7 @@ module Shoulda
745
762
  # end
746
763
  # end
747
764
  #
748
- # # Test::Unit
765
+ # # Minitest (Shoulda)
749
766
  # class PersonTest < ActiveSupport::TestCase
750
767
  # should have_and_belong_to_many(:projects).
751
768
  # order('time_spent')
@@ -768,7 +785,7 @@ module Shoulda
768
785
  # end
769
786
  # end
770
787
  #
771
- # # Test::Unit
788
+ # # Minitest (Shoulda)
772
789
  # class PersonTest < ActiveSupport::TestCase
773
790
  # should have_and_belong_to_many(:places_visited).
774
791
  # class_name('City')
@@ -791,7 +808,7 @@ module Shoulda
791
808
  # end
792
809
  # end
793
810
  #
794
- # # Test::Unit
811
+ # # Minitest (Shoulda)
795
812
  # class PersonTest < ActiveSupport::TestCase
796
813
  # should have_and_belong_to_many(:issues).
797
814
  # join_table('people_tickets')
@@ -813,7 +830,7 @@ module Shoulda
813
830
  # end
814
831
  # end
815
832
  #
816
- # # Test::Unit
833
+ # # Minitest (Shoulda)
817
834
  # class PersonTest < ActiveSupport::TestCase
818
835
  # should have_and_belong_to_many(:interviews).
819
836
  # validate(false)
@@ -832,7 +849,7 @@ module Shoulda
832
849
  # it { should have_and_belong_to_many(:advertisers).autosave(true) }
833
850
  # end
834
851
  #
835
- # # Test::Unit
852
+ # # Minitest (Shoulda)
836
853
  # class AccountTest < ActiveSupport::TestCase
837
854
  # should have_and_belong_to_many(:advertisers).autosave(true)
838
855
  # end
@@ -944,12 +961,10 @@ module Shoulda
944
961
  def failure_message
945
962
  "Expected #{expectation} (#{missing_options})"
946
963
  end
947
- alias failure_message_for_should failure_message
948
964
 
949
965
  def failure_message_when_negated
950
966
  "Did not expect #{expectation}"
951
967
  end
952
- alias failure_message_for_should_not failure_message_when_negated
953
968
 
954
969
  def matches?(subject)
955
970
  @subject = subject