rspec-mocks 3.0.4 → 3.1.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +26 -0
- data/README.md +29 -15
- data/lib/rspec/mocks/any_instance/chain.rb +2 -2
- data/lib/rspec/mocks/any_instance/expectation_chain.rb +2 -3
- data/lib/rspec/mocks/any_instance/message_chains.rb +8 -7
- data/lib/rspec/mocks/any_instance/proxy.rb +2 -2
- data/lib/rspec/mocks/any_instance/recorder.rb +27 -25
- data/lib/rspec/mocks/any_instance/stub_chain.rb +3 -5
- data/lib/rspec/mocks/argument_list_matcher.rb +4 -4
- data/lib/rspec/mocks/argument_matchers.rb +23 -5
- data/lib/rspec/mocks/configuration.rb +3 -10
- data/lib/rspec/mocks/error_generator.rb +33 -27
- data/lib/rspec/mocks/example_methods.rb +74 -6
- data/lib/rspec/mocks/instance_method_stasher.rb +5 -5
- data/lib/rspec/mocks/matchers/have_received.rb +7 -8
- data/lib/rspec/mocks/matchers/receive.rb +8 -8
- data/lib/rspec/mocks/matchers/receive_message_chain.rb +4 -5
- data/lib/rspec/mocks/matchers/receive_messages.rb +6 -7
- data/lib/rspec/mocks/message_chain.rb +5 -5
- data/lib/rspec/mocks/message_expectation.rb +56 -28
- data/lib/rspec/mocks/method_double.rb +15 -12
- data/lib/rspec/mocks/method_reference.rb +8 -7
- data/lib/rspec/mocks/mutate_const.rb +26 -100
- data/lib/rspec/mocks/object_reference.rb +12 -13
- data/lib/rspec/mocks/order_group.rb +4 -5
- data/lib/rspec/mocks/proxy.rb +31 -25
- data/lib/rspec/mocks/space.rb +24 -24
- data/lib/rspec/mocks/syntax.rb +8 -8
- data/lib/rspec/mocks/targets.rb +6 -6
- data/lib/rspec/mocks/test_double.rb +3 -3
- data/lib/rspec/mocks/verifying_double.rb +10 -12
- data/lib/rspec/mocks/verifying_message_expecation.rb +15 -13
- data/lib/rspec/mocks/verifying_proxy.rb +11 -15
- data/lib/rspec/mocks/version.rb +1 -1
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16d5f671e68051be014fb930e9980f5a0c19d5ee
|
4
|
+
data.tar.gz: b035e939d0afc695e7b03485f1edc2356c5b0bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46ba65b5222400961866c699044adba07374c0a2c241e2f011e2eb55b8fdfc3c167db0f371a925a06704ac6d209e1400a1802c45d94ea25ae38142bcf396c9bc
|
7
|
+
data.tar.gz: 617ae574ebe247f7b2ee1c6a45a94fb200006b56dd8c98ec536d655622a85749e0a10985e491e47709a744ebc450d494d591b5367c91bd89cc3f0001e6f95c9b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
### 3.1.0 / 2014-09-04
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.4...v3.1.0)
|
3
|
+
|
4
|
+
Enhancements:
|
5
|
+
|
6
|
+
* Add spying methods (`spy`, `ìnstance_spy`, `class_spy` and `object_spy`)
|
7
|
+
which create doubles as null objects for use with spying in testing. (Sam
|
8
|
+
Phippen, #671)
|
9
|
+
* `have_received` matcher will raise "does not implement" errors correctly when
|
10
|
+
used with verifying doubles and partial doubles. (Xavier Shay, #722)
|
11
|
+
* Allow matchers to be used in place of keyword arguments in `with`
|
12
|
+
expectations. (Xavier Shay, #726)
|
13
|
+
* Add `thrice` modifier to message expectation interface as a synonym
|
14
|
+
for `exactly(3).times`. (Dennis Taylor, #753)
|
15
|
+
* Add more `thrice` synonyms e.g. `.at_least(:thrice)`, `.at_most(:thrice)`,
|
16
|
+
`receive(...).thrice` and `have_received(...).thrice`. (Jon Rowe, #754)
|
17
|
+
* Add `and_wrap_original` modifier for partial doubles to mutate the
|
18
|
+
response from a method. (Jon Rowe, #762)
|
19
|
+
|
20
|
+
Bugfixes:
|
21
|
+
|
22
|
+
* Remove `any_number_of_times` from `any_instance` recorders that were
|
23
|
+
erroneously causing mention of the method in documentation. (Jon Rowe, #760)
|
24
|
+
* Prevent included modules being detected as prepended modules on Ruby 2.0.
|
25
|
+
(Eugene Kenny, #771)
|
26
|
+
|
1
27
|
### 3.0.4 / 2014-08-14
|
2
28
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.3...v3.0.4)
|
3
29
|
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
# RSpec Mocks [](http://travis-ci.org/rspec/rspec-mocks) [](https://codeclimate.com/github/rspec/rspec-mocks)
|
2
|
-
|
1
|
+
# RSpec Mocks [](http://travis-ci.org/rspec/rspec-mocks) [](https://codeclimate.com/github/rspec/rspec-mocks)
|
3
2
|
rspec-mocks is a test-double framework for rspec with support for method stubs,
|
4
3
|
fakes, and message expectations on generated test-doubles and real objects
|
5
4
|
alike.
|
@@ -102,24 +101,38 @@ zipcode.valid?
|
|
102
101
|
|
103
102
|
## Test Spies
|
104
103
|
|
105
|
-
Verifies the given object received the expected message during the course of
|
106
|
-
test.
|
107
|
-
|
104
|
+
Verifies the given object received the expected message during the course of
|
105
|
+
the test. For a message to be verified, the given object must be setup to spy
|
106
|
+
on it, either by having it explicitly stubbed or by being a null object double
|
107
|
+
(e.g. `double(...).as_null_object`). Convenience methods are provided to easily
|
108
|
+
create null object doubles for this purpose:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
spy("invitation") # => same as `double("invitation").as_null_object`
|
112
|
+
instance_spy("Invitation") # => same as `instance_double("Invitation").as_null_object`
|
113
|
+
class_spy("Invitation") # => same as `class_double("Invitation").as_null_object`
|
114
|
+
object_spy("Invitation") # => same as `object_double("Invitation").as_null_object`
|
115
|
+
```
|
108
116
|
|
109
117
|
Stubbing and verifying messages received in this way implements the Test Spy
|
110
118
|
pattern.
|
111
119
|
|
112
120
|
```ruby
|
113
|
-
|
121
|
+
invitation = spy('invitation')
|
122
|
+
|
123
|
+
user.accept_invitation(invitation)
|
114
124
|
|
115
|
-
|
125
|
+
expect(invitation).to have_received(:accept)
|
116
126
|
|
117
|
-
|
127
|
+
# You can also use other common message expectations. For example:
|
128
|
+
expect(invitation).to have_received(:accept).with(mailer)
|
129
|
+
expect(invitation).to have_received(:accept).twice
|
130
|
+
expect(invitation).to_not have_received(:accept).with(mailer)
|
118
131
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
132
|
+
# One can specify a return value on the spy the same way one would a double.
|
133
|
+
invitation = spy('invitation', :accept => true)
|
134
|
+
expect(invitation).to have_received(:accept).with(mailer)
|
135
|
+
expect(invitation.accept).to eq(true)
|
123
136
|
```
|
124
137
|
|
125
138
|
## Nomenclature
|
@@ -196,8 +209,10 @@ expect(double).to receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can
|
|
196
209
|
expect(double).to receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
|
197
210
|
expect(double).to receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
|
198
211
|
expect(double).to receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
|
199
|
-
expect(double).to receive(:msg).with(1, duck_type(:abs, :div), "b")
|
200
|
-
|
212
|
+
expect(double).to receive(:msg).with(1, duck_type(:abs, :div), "b") #2nd argument can be object that responds to #abs and #div
|
213
|
+
expect(double).to receive(:msg).with(hash_including(:a => 5)) # first arg is a hash with a: 5 as one of the key-values
|
214
|
+
expect(double).to receive(:msg).with(array_including(5)) # first arg is an array with 5 as one of the key-values
|
215
|
+
expect(double).to receive(:msg).with(hash_excluding(:a => 5)) # first arg is a hash without a: 5 as one of the key-values
|
201
216
|
```
|
202
217
|
|
203
218
|
## Receive Counts
|
@@ -212,7 +227,6 @@ expect(double).to receive(:msg).at_least(n).times
|
|
212
227
|
expect(double).to receive(:msg).at_most(:once)
|
213
228
|
expect(double).to receive(:msg).at_most(:twice)
|
214
229
|
expect(double).to receive(:msg).at_most(n).times
|
215
|
-
expect(double).to receive(:msg).any_number_of_times
|
216
230
|
```
|
217
231
|
|
218
232
|
## Ordering
|
@@ -37,7 +37,7 @@ module RSpec
|
|
37
37
|
record :with
|
38
38
|
record :once
|
39
39
|
record :twice
|
40
|
-
record :
|
40
|
+
record :thrice
|
41
41
|
record :exactly
|
42
42
|
record :times
|
43
43
|
record :never
|
@@ -84,7 +84,7 @@ module RSpec
|
|
84
84
|
super
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
private
|
88
88
|
|
89
89
|
def negated?
|
90
90
|
messages.any? { |(message, *_), _| message == :never }
|
@@ -4,7 +4,7 @@ module RSpec
|
|
4
4
|
# @private
|
5
5
|
class ExpectationChain < Chain
|
6
6
|
def expectation_fulfilled?
|
7
|
-
@expectation_fulfilled || constrained_to_any_of?(:never
|
7
|
+
@expectation_fulfilled || constrained_to_any_of?(:never)
|
8
8
|
end
|
9
9
|
|
10
10
|
def initialize(*args, &block)
|
@@ -14,13 +14,12 @@ module RSpec
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def verify_invocation_order(
|
17
|
+
def verify_invocation_order(_rspec_method_name, *_args, &_block)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
# @private
|
22
22
|
class PositiveExpectationChain < ExpectationChain
|
23
|
-
|
24
23
|
private
|
25
24
|
|
26
25
|
def create_message_expectation_on(instance)
|
@@ -35,15 +35,13 @@ module RSpec
|
|
35
35
|
# @private
|
36
36
|
def each_unfulfilled_expectation_matching(method_name, *args)
|
37
37
|
@chains_by_method_name[method_name].each do |chain|
|
38
|
-
if !chain.expectation_fulfilled? && chain.matches_args?(*args)
|
39
|
-
yield chain
|
40
|
-
end
|
38
|
+
yield chain if !chain.expectation_fulfilled? && chain.matches_args?(*args)
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
44
42
|
# @private
|
45
43
|
def all_expectations_fulfilled?
|
46
|
-
@chains_by_method_name.all? do |
|
44
|
+
@chains_by_method_name.all? do |_method_name, chains|
|
47
45
|
chains.all? { |chain| chain.expectation_fulfilled? }
|
48
46
|
end
|
49
47
|
end
|
@@ -74,9 +72,12 @@ module RSpec
|
|
74
72
|
|
75
73
|
def raise_if_second_instance_to_receive_message(instance)
|
76
74
|
@instance_with_expectation ||= instance if ExpectationChain === instance
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
return unless ExpectationChain === instance
|
76
|
+
return if @instance_with_expectation.equal?(instance)
|
77
|
+
|
78
|
+
raise RSpec::Mocks::MockExpectationError,
|
79
|
+
"Exactly one instance should have received the following " \
|
80
|
+
"message(s) but didn't: #{unfulfilled_expectations.sort.join(', ')}"
|
80
81
|
end
|
81
82
|
end
|
82
83
|
end
|
@@ -97,11 +97,11 @@ module RSpec
|
|
97
97
|
end
|
98
98
|
|
99
99
|
if RUBY_VERSION.to_f > 1.8
|
100
|
-
def respond_to_missing?(method_name, include_private
|
100
|
+
def respond_to_missing?(method_name, include_private=false)
|
101
101
|
super || @targets.first.respond_to?(method_name, include_private)
|
102
102
|
end
|
103
103
|
else
|
104
|
-
def respond_to?(method_name, include_private
|
104
|
+
def respond_to?(method_name, include_private=false)
|
105
105
|
super || @targets.first.respond_to?(method_name, include_private)
|
106
106
|
end
|
107
107
|
end
|
@@ -15,7 +15,7 @@ module RSpec
|
|
15
15
|
|
16
16
|
def initialize(klass)
|
17
17
|
@message_chains = MessageChains.new
|
18
|
-
@stubs = Hash.new { |hash,key| hash[key] = [] }
|
18
|
+
@stubs = Hash.new { |hash, key| hash[key] = [] }
|
19
19
|
@observed_methods = []
|
20
20
|
@played_methods = {}
|
21
21
|
@klass = klass
|
@@ -88,14 +88,17 @@ module RSpec
|
|
88
88
|
# Used internally to verify that message expectations have been
|
89
89
|
# fulfilled.
|
90
90
|
def verify
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
return unless @expectation_set
|
92
|
+
return if message_chains.all_expectations_fulfilled?
|
93
|
+
|
94
|
+
raise RSpec::Mocks::MockExpectationError,
|
95
|
+
"Exactly one instance should have received the following " \
|
96
|
+
"message(s) but didn't: #{message_chains.unfulfilled_expectations.sort.join(', ')}"
|
94
97
|
end
|
95
98
|
|
96
99
|
# @private
|
97
100
|
def stop_all_observation!
|
98
|
-
@observed_methods.each {|method_name| restore_method!(method_name)}
|
101
|
+
@observed_methods.each { |method_name| restore_method!(method_name) }
|
99
102
|
end
|
100
103
|
|
101
104
|
# @private
|
@@ -122,7 +125,7 @@ module RSpec
|
|
122
125
|
end
|
123
126
|
|
124
127
|
# @private
|
125
|
-
def notify_received_message(
|
128
|
+
def notify_received_message(_object, message, args, _blk)
|
126
129
|
has_expectation = false
|
127
130
|
|
128
131
|
message_chains.each_unfulfilled_expectation_matching(message, *args) do |expectation|
|
@@ -130,10 +133,10 @@ module RSpec
|
|
130
133
|
expectation.expectation_fulfilled!
|
131
134
|
end
|
132
135
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
136
|
+
return unless has_expectation
|
137
|
+
|
138
|
+
restore_method!(message)
|
139
|
+
mark_invoked!(message)
|
137
140
|
end
|
138
141
|
|
139
142
|
protected
|
@@ -167,7 +170,7 @@ module RSpec
|
|
167
170
|
end
|
168
171
|
|
169
172
|
def normalize_chain(*args)
|
170
|
-
args.shift.to_s.split('.').map {|s| s.to_sym}.reverse.each {|a| args.unshift a}
|
173
|
+
args.shift.to_s.split('.').map { |s| s.to_sym }.reverse.each { |a| args.unshift a }
|
171
174
|
yield args.first, args
|
172
175
|
end
|
173
176
|
|
@@ -186,13 +189,13 @@ module RSpec
|
|
186
189
|
end
|
187
190
|
|
188
191
|
def restore_original_method!(method_name)
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
192
|
+
return unless @klass.instance_method(method_name).owner == @klass
|
193
|
+
|
194
|
+
alias_method_name = build_alias_method_name(method_name)
|
195
|
+
@klass.class_exec do
|
196
|
+
remove_method method_name
|
197
|
+
alias_method method_name, alias_method_name
|
198
|
+
remove_method alias_method_name
|
196
199
|
end
|
197
200
|
end
|
198
201
|
|
@@ -219,7 +222,7 @@ module RSpec
|
|
219
222
|
if RSpec::Mocks.configuration.verify_partial_doubles?
|
220
223
|
unless public_protected_or_private_method_defined?(method_name)
|
221
224
|
raise MockExpectationError,
|
222
|
-
|
225
|
+
"#{@klass} does not implement ##{method_name}"
|
223
226
|
end
|
224
227
|
end
|
225
228
|
|
@@ -229,14 +232,14 @@ module RSpec
|
|
229
232
|
recorder = self
|
230
233
|
@klass.__send__(:define_method, method_name) do |*args, &blk|
|
231
234
|
recorder.playback!(self, method_name)
|
232
|
-
|
235
|
+
__send__(method_name, *args, &blk)
|
233
236
|
end
|
234
237
|
end
|
235
238
|
|
236
239
|
def mark_invoked!(method_name)
|
237
240
|
backup_method!(method_name)
|
238
241
|
recorder = self
|
239
|
-
@klass.__send__(:define_method, method_name) do |*
|
242
|
+
@klass.__send__(:define_method, method_name) do |*_args, &_blk|
|
240
243
|
invoked_instance = recorder.instance_that_received(method_name)
|
241
244
|
inspect = "#<#{self.class}:#{object_id} #{instance_variables.map { |name| "#{name}=#{instance_variable_get name}" }.join(', ')}>"
|
242
245
|
raise RSpec::Mocks::MockExpectationError, "The message '#{method_name}' was received by #{inspect} but has already been received by #{invoked_instance}"
|
@@ -250,15 +253,14 @@ module RSpec
|
|
250
253
|
return unless problem_mod
|
251
254
|
|
252
255
|
raise RSpec::Mocks::MockExpectationError,
|
253
|
-
|
254
|
-
|
256
|
+
"Using `any_instance` to stub a method (#{method_name}) that has been " \
|
257
|
+
"defined on a prepended module (#{problem_mod}) is not supported."
|
255
258
|
end
|
256
259
|
else
|
257
|
-
def allow_no_prepended_module_definition_of(
|
260
|
+
def allow_no_prepended_module_definition_of(_method_name)
|
258
261
|
# nothing to do; prepends aren't supported on this version of ruby
|
259
262
|
end
|
260
263
|
end
|
261
|
-
|
262
264
|
end
|
263
265
|
end
|
264
266
|
end
|
@@ -3,7 +3,6 @@ module RSpec
|
|
3
3
|
module AnyInstance
|
4
4
|
# @private
|
5
5
|
class StubChain < Chain
|
6
|
-
|
7
6
|
# @private
|
8
7
|
def expectation_fulfilled?
|
9
8
|
true
|
@@ -36,10 +35,9 @@ module RSpec
|
|
36
35
|
}
|
37
36
|
end
|
38
37
|
|
39
|
-
def verify_invocation_order(rspec_method_name, *
|
40
|
-
|
41
|
-
|
42
|
-
end
|
38
|
+
def verify_invocation_order(rspec_method_name, *_args, &_block)
|
39
|
+
return if invocation_order[rspec_method_name].include?(last_message)
|
40
|
+
raise NoMethodError, "Undefined method #{rspec_method_name}"
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|
@@ -46,10 +46,10 @@ module RSpec
|
|
46
46
|
@expected_args = expected_args
|
47
47
|
|
48
48
|
@matchers = case expected_args.first
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
when ArgumentMatchers::AnyArgsMatcher then Array
|
50
|
+
when ArgumentMatchers::NoArgsMatcher then []
|
51
|
+
else expected_args
|
52
|
+
end
|
53
53
|
end
|
54
54
|
|
55
55
|
# @api public
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# This cannot take advantage of our relative requires, since this file is a
|
2
|
+
# dependency of `rspec/mocks/argument_list_matcher.rb`. See comment there for
|
3
|
+
# details.
|
4
|
+
require 'rspec/support/matcher_definition'
|
5
|
+
|
1
6
|
module RSpec
|
2
7
|
module Mocks
|
3
|
-
|
4
8
|
# ArgumentMatchers are placeholders that you can include in message
|
5
9
|
# expectations to match arguments against a broader check than simple
|
6
10
|
# equality.
|
@@ -131,7 +135,7 @@ module RSpec
|
|
131
135
|
|
132
136
|
# @private
|
133
137
|
class AnyArgMatcher
|
134
|
-
def ===(
|
138
|
+
def ===(_other)
|
135
139
|
true
|
136
140
|
end
|
137
141
|
|
@@ -166,14 +170,14 @@ module RSpec
|
|
166
170
|
|
167
171
|
def ===(predicate, actual)
|
168
172
|
@expected.__send__(predicate) do |k, v|
|
169
|
-
actual.
|
173
|
+
actual.key?(k) && Support::FuzzyMatcher.values_match?(v, actual[k])
|
170
174
|
end
|
171
175
|
rescue NoMethodError
|
172
176
|
false
|
173
177
|
end
|
174
178
|
|
175
179
|
def description(name)
|
176
|
-
"#{name}(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
|
180
|
+
"#{name}(#{@expected.inspect.sub(/^\{/, "").sub(/\}$/, "")})"
|
177
181
|
end
|
178
182
|
end
|
179
183
|
|
@@ -221,7 +225,7 @@ module RSpec
|
|
221
225
|
end
|
222
226
|
|
223
227
|
def ===(value)
|
224
|
-
@methods_to_respond_to.all? {|message| value.respond_to?(message)}
|
228
|
+
@methods_to_respond_to.all? { |message| value.respond_to?(message) }
|
225
229
|
end
|
226
230
|
|
227
231
|
def description
|
@@ -259,6 +263,20 @@ module RSpec
|
|
259
263
|
end
|
260
264
|
end
|
261
265
|
|
266
|
+
matcher_namespace = name + '::'
|
267
|
+
::RSpec::Support.register_matcher_definition do |object|
|
268
|
+
# This is the best we have for now. We should tag all of our matchers
|
269
|
+
# with a module or something so we can test for it directly.
|
270
|
+
#
|
271
|
+
# (Note Module#parent in ActiveSupport is defined in a similar way.)
|
272
|
+
begin
|
273
|
+
object.class.name.include?(matcher_namespace)
|
274
|
+
rescue NoMethodError
|
275
|
+
# Some objects, like BasicObject, don't implemented standard
|
276
|
+
# reflection methods.
|
277
|
+
false
|
278
|
+
end
|
279
|
+
end
|
262
280
|
end
|
263
281
|
end
|
264
282
|
end
|
@@ -2,7 +2,6 @@ module RSpec
|
|
2
2
|
module Mocks
|
3
3
|
# Provides configuration options for rspec-mocks.
|
4
4
|
class Configuration
|
5
|
-
|
6
5
|
def initialize
|
7
6
|
@yield_receiver_to_any_instance_implementation_blocks = true
|
8
7
|
@verify_doubled_constant_names = false
|
@@ -26,9 +25,7 @@ module RSpec
|
|
26
25
|
# mocks.yield_receiver_to_any_instance_implementation_blocks = false
|
27
26
|
# end
|
28
27
|
# end
|
29
|
-
|
30
|
-
@yield_receiver_to_any_instance_implementation_blocks = arg
|
31
|
-
end
|
28
|
+
attr_writer :yield_receiver_to_any_instance_implementation_blocks
|
32
29
|
|
33
30
|
# Adds `stub` and `should_receive` to the given
|
34
31
|
# modules or classes. This is usually only necessary
|
@@ -105,9 +102,7 @@ module RSpec
|
|
105
102
|
# constant. You probably only want to set this when running your entire
|
106
103
|
# test suite, with all production code loaded. Setting this for an
|
107
104
|
# isolated unit test will prevent you from being able to isolate it!
|
108
|
-
|
109
|
-
@verify_doubled_constant_names = val
|
110
|
-
end
|
105
|
+
attr_writer :verify_doubled_constant_names
|
111
106
|
|
112
107
|
def transfer_nested_constants?
|
113
108
|
!!@transfer_nested_constants
|
@@ -115,9 +110,7 @@ module RSpec
|
|
115
110
|
|
116
111
|
# Sets the default for the `transfer_nested_constants` option when
|
117
112
|
# stubbing constants.
|
118
|
-
|
119
|
-
@transfer_nested_constants = val
|
120
|
-
end
|
113
|
+
attr_writer :transfer_nested_constants
|
121
114
|
|
122
115
|
# When set to true, partial mocks will be verified the same as object
|
123
116
|
# doubles. Any stubs will have their arguments checked against the original
|