shoulda-matchers 3.0.0.rc1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -14,7 +14,7 @@ module Shoulda
14
14
  # end
15
15
  # end
16
16
  #
17
- # # Test::Unit
17
+ # # Minitest (Shoulda)
18
18
  # class ProcessTest < ActiveSupport::TestCase
19
19
  # should define_enum_for(:status)
20
20
  # end
@@ -38,7 +38,7 @@ module Shoulda
38
38
  # end
39
39
  # end
40
40
  #
41
- # # Test::Unit
41
+ # # Minitest (Shoulda)
42
42
  # class ProcessTest < ActiveSupport::TestCase
43
43
  # should define_enum_for(:status).
44
44
  # with([:running, :stopped, :suspended])
@@ -17,7 +17,7 @@ module Shoulda
17
17
  # it { should have_db_column(:supported_ios_version) }
18
18
  # end
19
19
  #
20
- # # Test::Unit
20
+ # # Minitest (Shoulda)
21
21
  # class PhoneTest < ActiveSupport::TestCase
22
22
  # should have_db_column(:supported_ios_version)
23
23
  # end
@@ -43,7 +43,7 @@ module Shoulda
43
43
  # end
44
44
  # end
45
45
  #
46
- # # Test::Unit
46
+ # # Minitest (Shoulda)
47
47
  # class PhoneTest < ActiveSupport::TestCase
48
48
  # should have_db_column(:camera_aperture).of_type(:decimal)
49
49
  # end
@@ -70,7 +70,7 @@ module Shoulda
70
70
  # end
71
71
  # end
72
72
  #
73
- # # Test::Unit
73
+ # # Minitest (Shoulda)
74
74
  # class PhoneTest < ActiveSupport::TestCase
75
75
  # should have_db_column(:camera_aperture).
76
76
  # with_options(precision: 1, null: false)
@@ -118,12 +118,10 @@ module Shoulda
118
118
  def failure_message
119
119
  "Expected #{expectation} (#{@missing})"
120
120
  end
121
- alias failure_message_for_should failure_message
122
121
 
123
122
  def failure_message_when_negated
124
123
  "Did not expect #{expectation}"
125
124
  end
126
- alias failure_message_for_should_not failure_message_when_negated
127
125
 
128
126
  def description
129
127
  desc = "have db column named #{@column}"
@@ -19,7 +19,7 @@ module Shoulda
19
19
  # it { should have_db_index(:user_id) }
20
20
  # end
21
21
  #
22
- # # Test::Unit
22
+ # # Minitest (Shoulda)
23
23
  # class BlogTest < ActiveSupport::TestCase
24
24
  # should have_db_index(:user_id)
25
25
  # end
@@ -45,7 +45,7 @@ module Shoulda
45
45
  # it { should have_db_index(:name).unique(true) }
46
46
  # end
47
47
  #
48
- # # Test::Unit
48
+ # # Minitest (Shoulda)
49
49
  # class BlogTest < ActiveSupport::TestCase
50
50
  # should have_db_index(:name).unique(true)
51
51
  # end
@@ -58,7 +58,7 @@ module Shoulda
58
58
  # it { should have_db_index(:name).unique }
59
59
  # end
60
60
  #
61
- # # Test::Unit
61
+ # # Minitest (Shoulda)
62
62
  # class BlogTest < ActiveSupport::TestCase
63
63
  # should have_db_index(:name).unique
64
64
  # end
@@ -89,12 +89,10 @@ module Shoulda
89
89
  def failure_message
90
90
  "Expected #{expectation} (#{@missing})"
91
91
  end
92
- alias failure_message_for_should failure_message
93
92
 
94
93
  def failure_message_when_negated
95
94
  "Did not expect #{expectation}"
96
95
  end
97
- alias failure_message_for_should_not failure_message_when_negated
98
96
 
99
97
  def description
100
98
  if @options.key?(:unique)
@@ -13,7 +13,7 @@ module Shoulda
13
13
  # it { should have_readonly_attribute(:password) }
14
14
  # end
15
15
  #
16
- # # Test::Unit
16
+ # # Minitest (Shoulda)
17
17
  # class UserTest < ActiveSupport::TestCase
18
18
  # should have_readonly_attribute(:password)
19
19
  # end
@@ -32,9 +32,6 @@ module Shoulda
32
32
 
33
33
  attr_reader :failure_message, :failure_message_when_negated
34
34
 
35
- alias failure_message_for_should failure_message
36
- alias failure_message_for_should_not failure_message_when_negated
37
-
38
35
  def matches?(subject)
39
36
  @subject = subject
40
37
  if readonly_attributes.include?(@attribute)
@@ -12,7 +12,7 @@ module Shoulda
12
12
  # it { should serialize(:customizations) }
13
13
  # end
14
14
  #
15
- # # Test::Unit
15
+ # # Minitest (Shoulda)
16
16
  # class ProductTest < ActiveSupport::TestCase
17
17
  # should serialize(:customizations)
18
18
  # end
@@ -45,7 +45,7 @@ module Shoulda
45
45
  # end
46
46
  # end
47
47
  #
48
- # # Test::Unit
48
+ # # Minitest (Shoulda)
49
49
  # class ProductTest < ActiveSupport::TestCase
50
50
  # should serialize(:specifications).
51
51
  # as(ProductSpecsSerializer)
@@ -77,7 +77,7 @@ module Shoulda
77
77
  # end
78
78
  # end
79
79
  #
80
- # # Test::Unit
80
+ # # Minitest (Shoulda)
81
81
  # class ProductTest < ActiveSupport::TestCase
82
82
  # should serialize(:options).
83
83
  # as_instance_of(ProductOptionsSerializer)
@@ -114,12 +114,10 @@ module Shoulda
114
114
  def failure_message
115
115
  "Expected #{expectation} (#{@missing})"
116
116
  end
117
- alias failure_message_for_should failure_message
118
117
 
119
118
  def failure_message_when_negated
120
119
  "Did not expect #{expectation}"
121
120
  end
122
- alias failure_message_for_should_not failure_message_when_negated
123
121
 
124
122
  def description
125
123
  description = "serialize :#{@name}"
@@ -18,7 +18,7 @@ module Shoulda
18
18
  # it { should validate_uniqueness_of(:permalink) }
19
19
  # end
20
20
  #
21
- # # Test::Unit
21
+ # # Minitest (Shoulda)
22
22
  # class PostTest < ActiveSupport::TestCase
23
23
  # should validate_uniqueness_of(:permalink)
24
24
  # end
@@ -99,7 +99,7 @@ module Shoulda
99
99
  # it { should validate_uniqueness_of(:title).on(:create) }
100
100
  # end
101
101
  #
102
- # # Test::Unit
102
+ # # Minitest (Shoulda)
103
103
  # class PostTest < ActiveSupport::TestCase
104
104
  # should validate_uniqueness_of(:title).on(:create)
105
105
  # end
@@ -120,7 +120,7 @@ module Shoulda
120
120
  # end
121
121
  # end
122
122
  #
123
- # # Test::Unit
123
+ # # Minitest (Shoulda)
124
124
  # class PostTest < ActiveSupport::TestCase
125
125
  # should validate_uniqueness_of(:title).
126
126
  # with_message('Please choose another title')
@@ -141,7 +141,7 @@ module Shoulda
141
141
  # it { should validate_uniqueness_of(:slug).scoped_to(:journal_id) }
142
142
  # end
143
143
  #
144
- # # Test::Unit
144
+ # # Minitest (Shoulda)
145
145
  # class PostTest < ActiveSupport::TestCase
146
146
  # should validate_uniqueness_of(:slug).scoped_to(:journal_id)
147
147
  # end
@@ -162,7 +162,7 @@ module Shoulda
162
162
  # it { should validate_uniqueness_of(:key).case_insensitive }
163
163
  # end
164
164
  #
165
- # # Test::Unit
165
+ # # Minitest (Shoulda)
166
166
  # class PostTest < ActiveSupport::TestCase
167
167
  # should validate_uniqueness_of(:key).case_insensitive
168
168
  # end
@@ -180,7 +180,7 @@ module Shoulda
180
180
  # it { should validate_uniqueness_of(:author_id).allow_nil }
181
181
  # end
182
182
  #
183
- # # Test::Unit
183
+ # # Minitest (Shoulda)
184
184
  # class PostTest < ActiveSupport::TestCase
185
185
  # should validate_uniqueness_of(:author_id).allow_nil
186
186
  # end
@@ -200,7 +200,7 @@ module Shoulda
200
200
  # it { should validate_uniqueness_of(:author_id).allow_blank }
201
201
  # end
202
202
  #
203
- # # Test::Unit
203
+ # # Minitest (Shoulda)
204
204
  # class PostTest < ActiveSupport::TestCase
205
205
  # should validate_uniqueness_of(:author_id).allow_blank
206
206
  # end
@@ -12,6 +12,14 @@ module Shoulda
12
12
  @implementation = implementation
13
13
  @activated = false
14
14
  @calls = []
15
+
16
+ if world.doubles_activated?
17
+ activate
18
+ end
19
+ end
20
+
21
+ def activated?
22
+ @activated
15
23
  end
16
24
 
17
25
  def to_return(value = nil, &block)
@@ -73,7 +81,8 @@ module Shoulda
73
81
  object: self,
74
82
  method_name: _method_name,
75
83
  args: args,
76
- block: block
84
+ block: block,
85
+ caller: caller
77
86
  )
78
87
  implementation.call(call)
79
88
  end
@@ -29,6 +29,12 @@ module Shoulda
29
29
  end
30
30
  end
31
31
 
32
+ def calls_by_method_name
33
+ doubles_by_method_name.reduce({}) do |hash, (method_name, double)|
34
+ hash.merge method_name => double.calls.map(&:args)
35
+ end
36
+ end
37
+
32
38
  def calls_to(method_name)
33
39
  double = doubles_by_method_name[method_name]
34
40
 
@@ -44,11 +50,13 @@ module Shoulda
44
50
  attr_reader :world, :klass, :doubles_by_method_name
45
51
 
46
52
  def register_double(method_name, implementation_type)
47
- implementation =
48
- DoubleImplementationRegistry.find(implementation_type)
49
- double = Double.new(world, klass, method_name, implementation)
50
- doubles_by_method_name[method_name] = double
51
- double
53
+ doubles_by_method_name.fetch(method_name) do
54
+ implementation =
55
+ DoubleImplementationRegistry.find(implementation_type)
56
+ double = Double.new(world, klass, method_name, implementation)
57
+ doubles_by_method_name[method_name] = double
58
+ double
59
+ end
52
60
  end
53
61
  end
54
62
  end
@@ -4,11 +4,12 @@ module Shoulda
4
4
  # @private
5
5
  class MethodCall
6
6
  attr_accessor :return_value
7
- attr_reader :method_name, :args, :block, :object, :double
7
+ attr_reader :method_name, :args, :caller, :block, :object, :double
8
8
 
9
9
  def initialize(args)
10
10
  @method_name = args.fetch(:method_name)
11
11
  @args = args.fetch(:args)
12
+ @caller = args.fetch(:caller)
12
13
  @block = args[:block]
13
14
  @double = args[:double]
14
15
  @object = args[:object]
@@ -29,6 +30,14 @@ module Shoulda
29
30
  double == other.double &&
30
31
  object == other.object
31
32
  end
33
+
34
+ def to_hash
35
+ { method_name: method_name, args: args }
36
+ end
37
+
38
+ def inspect
39
+ "#<#{self.class.name} #{to_hash.inspect}>"
40
+ end
32
41
  end
33
42
  end
34
43
  end
@@ -22,7 +22,8 @@ module Shoulda
22
22
  call = MethodCall.new(
23
23
  method_name: method_name,
24
24
  args: args,
25
- block: block
25
+ block: block,
26
+ caller: ::Kernel.caller
26
27
  )
27
28
  calls << call
28
29
  (calls_by_method_name[method_name] ||= []) << call
@@ -3,6 +3,10 @@ module Shoulda
3
3
  module Doublespeak
4
4
  # @private
5
5
  class World
6
+ def initialize
7
+ @doubles_activated = false
8
+ end
9
+
6
10
  def double_collection_for(klass)
7
11
  double_collections_by_class[klass] ||=
8
12
  DoubleCollection.new(self, klass)
@@ -20,12 +24,18 @@ module Shoulda
20
24
  end
21
25
 
22
26
  def with_doubles_activated
27
+ @doubles_activated = true
23
28
  activate
24
29
  yield
25
30
  ensure
31
+ @doubles_activated = false
26
32
  deactivate
27
33
  end
28
34
 
35
+ def doubles_activated?
36
+ @doubles_activated
37
+ end
38
+
29
39
  private
30
40
 
31
41
  def activate
@@ -20,6 +20,10 @@ module Shoulda
20
20
  def message
21
21
  ""
22
22
  end
23
+
24
+ def inspect
25
+ %(#<#{self.class}: #{message}>)
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -1,3 +1,6 @@
1
+ require 'shoulda/matchers/doublespeak'
2
+ require 'shoulda/matchers/matcher_context'
3
+
1
4
  module Shoulda
2
5
  module Matchers
3
6
  module Independent
@@ -26,8 +29,8 @@ module Shoulda
26
29
  # it { should delegate_method(:deliver).to(:post_office) }
27
30
  # end
28
31
  #
29
- # # Test::Unit
30
- # class CourierTest < Test::Unit::TestCase
32
+ # # Minitest
33
+ # class CourierTest < Minitest::Test
31
34
  # should delegate_method(:deliver).to(:post_office)
32
35
  # end
33
36
  #
@@ -77,8 +80,8 @@ module Shoulda
77
80
  # it { should delegate_method(:deliver).to(:post_office).as(:ship) }
78
81
  # end
79
82
  #
80
- # # Test::Unit
81
- # class CourierTest < Test::Unit::TestCase
83
+ # # Minitest
84
+ # class CourierTest < Minitest::Test
82
85
  # should delegate_method(:deliver).to(:post_office).as(:ship)
83
86
  # end
84
87
  #
@@ -100,8 +103,8 @@ module Shoulda
100
103
  # it { should delegate_method(:title).to(:site).with_prefix(:root) }
101
104
  # end
102
105
  #
103
- # # Test::Unit
104
- # class PageTest < Test::Unit::TestCase
106
+ # # Minitest
107
+ # class PageTest < Minitest::Test
105
108
  # should delegate_method(:name).to(:site).with_prefix
106
109
  # should delegate_method(:name).to(:site).with_prefix(true)
107
110
  # should delegate_method(:title).to(:site).with_prefix(:root)
@@ -138,8 +141,8 @@ module Shoulda
138
141
  # end
139
142
  # end
140
143
  #
141
- # # Test::Unit
142
- # class CourierTest < Test::Unit::TestCase
144
+ # # Minitest
145
+ # class CourierTest < Minitest::Test
143
146
  # should delegate_method(:deliver_package).
144
147
  # to(:post_office).
145
148
  # with_arguments(expedited: true)
@@ -230,12 +233,10 @@ module Shoulda
230
233
  "#{formatted_delegate_object_reader_method_name(include_module: true)}:" +
231
234
  formatted_calls_on_delegate_object
232
235
  end
233
- alias failure_message_for_should failure_message
234
236
 
235
237
  def failure_message_when_negated
236
238
  "Expected #{class_under_test} not to #{description}, but it did"
237
239
  end
238
- alias failure_message_for_should_not failure_message_when_negated
239
240
 
240
241
  protected
241
242
 
@@ -3,6 +3,7 @@ require 'shoulda/matchers/integrations/libraries/active_model'
3
3
  require 'shoulda/matchers/integrations/libraries/active_record'
4
4
  require 'shoulda/matchers/integrations/libraries/missing_library'
5
5
  require 'shoulda/matchers/integrations/libraries/rails'
6
+ require 'shoulda/matchers/integrations/libraries/routing'
6
7
 
7
8
  module Shoulda
8
9
  module Matchers
@@ -10,7 +10,7 @@ module Shoulda
10
10
  include Integrations::Rails
11
11
 
12
12
  def integrate_with(test_framework)
13
- test_framework.include(matchers_module)
13
+ test_framework.include(matchers_module, type: :controller)
14
14
 
15
15
  include_into(::ActionController::TestCase, matchers_module) do
16
16
  def subject
@@ -10,7 +10,7 @@ module Shoulda
10
10
  include Integrations::Rails
11
11
 
12
12
  def integrate_with(test_framework)
13
- test_framework.include(matchers_module)
13
+ test_framework.include(matchers_module, type: :model)
14
14
  include_into(ActiveSupport::TestCase, matchers_module)
15
15
  end
16
16