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.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/Gemfile.lock +12 -41
- data/NEWS.md +118 -26
- data/README.md +34 -11
- data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -0
- data/doc_config/yard/templates/default/fulldoc/html/css/style.css +4 -0
- data/gemfiles/4.0.0.gemfile +2 -3
- data/gemfiles/4.0.0.gemfile.lock +47 -77
- data/gemfiles/4.0.1.gemfile +2 -3
- data/gemfiles/4.0.1.gemfile.lock +51 -79
- data/gemfiles/4.1.gemfile +2 -3
- data/gemfiles/4.1.gemfile.lock +73 -103
- data/gemfiles/4.2.gemfile +2 -3
- data/gemfiles/4.2.gemfile.lock +90 -124
- data/lib/shoulda/matchers.rb +1 -0
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +6 -8
- data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +1 -3
- data/lib/shoulda/matchers/action_controller/flash_store.rb +1 -8
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +140 -88
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +2 -5
- data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +5 -10
- data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +2 -4
- data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +1 -3
- data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +3 -5
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -7
- data/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +35 -9
- data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model.rb +57 -1
- data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +2 -5
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +162 -54
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +5 -2
- data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +1 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +24 -11
- data/lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb +4 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +0 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb +4 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb +2 -1
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +15 -13
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +4 -4
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +12 -14
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +10 -4
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +0 -3
- data/lib/shoulda/matchers/active_model/validator.rb +0 -8
- data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +4 -6
- data/lib/shoulda/matchers/active_record/association_matcher.rb +58 -43
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +1 -4
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +7 -7
- data/lib/shoulda/matchers/doublespeak/double.rb +10 -1
- data/lib/shoulda/matchers/doublespeak/double_collection.rb +13 -5
- data/lib/shoulda/matchers/doublespeak/method_call.rb +10 -1
- data/lib/shoulda/matchers/doublespeak/object_double.rb +2 -1
- data/lib/shoulda/matchers/doublespeak/world.rb +10 -0
- data/lib/shoulda/matchers/error.rb +4 -0
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +11 -10
- data/lib/shoulda/matchers/integrations/libraries.rb +1 -0
- data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/active_model.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/active_record.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -1
- data/lib/shoulda/matchers/integrations/libraries/routing.rb +27 -0
- data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/rspec.rb +2 -2
- data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
- data/lib/shoulda/matchers/routing.rb +10 -0
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/SUPPORTED_VERSIONS +1 -1
- data/spec/acceptance/independent_matchers_spec.rb +103 -42
- data/spec/doublespeak_spec_helper.rb +5 -1
- data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +34 -11
- data/spec/support/acceptance/helpers/rspec_helpers.rb +9 -13
- data/spec/support/acceptance/helpers/step_helpers.rb +13 -0
- data/spec/support/acceptance/matchers/have_output.rb +1 -1
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +1 -1
- data/spec/support/tests/command_runner.rb +5 -1
- data/spec/support/unit/helpers/active_record_versions.rb +0 -4
- data/spec/support/unit/shared_examples/set_session_or_flash.rb +8 -3
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +198 -39
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +269 -102
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +24 -0
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +118 -101
- data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -82
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +148 -121
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +20 -8
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +64 -183
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +14 -0
- data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +60 -0
- data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +23 -7
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +242 -0
- data/spec/unit_spec_helper.rb +4 -0
- data/tasks/documentation.rb +35 -0
- metadata +9 -8
- data/Guardfile +0 -5
- data/cucumber.yml +0 -1
- 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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
# #
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
@@ -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
|
@@ -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
|
-
# #
|
30
|
-
# class CourierTest < Test
|
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
|
-
# #
|
81
|
-
# class CourierTest < Test
|
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
|
-
# #
|
104
|
-
# class PageTest < Test
|
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
|
-
# #
|
142
|
-
# class CourierTest < Test
|
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
|