rspec-mocks 3.0.2 → 3.0.3
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 +20 -1
- data/lib/rspec/mocks/matchers/have_received.rb +3 -0
- data/lib/rspec/mocks/proxy.rb +5 -0
- data/lib/rspec/mocks/syntax.rb +93 -91
- data/lib/rspec/mocks/test_double.rb +5 -0
- data/lib/rspec/mocks/version.rb +1 -1
- metadata +3 -3
- 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: fce3b18da2e05ea86c3651d08744828ea2c4664f
|
4
|
+
data.tar.gz: f6cfa7626887ee4673812b7d475080ba4a722beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38034eb9854b7aed1466e0d93a314c7565c15f24e1acdcf9dd07b65304569a75774fa8a589de05f3769160c3dee0623262ac93909a0423a54f2092cc7352143c
|
7
|
+
data.tar.gz: fe6bbe3f040c817df0ec44670e53874e740e1c68af6e718d7a711e5cbfdd1dfb88c4fda5740d8a394fea7f0af8d15281f59353be221670e9f7d64e950d2e8ac8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
### 3.0.3 / 2014-07-21
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.2...v3.0.3)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* `have_received` matcher will raise "does not implement" errors correctly when
|
7
|
+
used with verifying doubles and partial doubles. (Xavier Shay, #722)
|
8
|
+
* Make `double.as_null_object.dup` and `double.as_null_object.clone`
|
9
|
+
make the copies be null objects. (Myron Marston, #732)
|
10
|
+
* Don't inadvertently define `BasicObject` in 1.8.7. (Chris Griego, #739)
|
11
|
+
|
1
12
|
### 3.0.2 / 2014-06-19
|
2
13
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.1...v3.0.2)
|
3
14
|
|
@@ -164,7 +175,7 @@ Bug Fixes:
|
|
164
175
|
behavior. (Maurício Linhares)
|
165
176
|
|
166
177
|
### 3.0.0.beta1 / 2013-11-07
|
167
|
-
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.
|
178
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.2...v3.0.0.beta1)
|
168
179
|
|
169
180
|
Breaking Changes for 3.0.0:
|
170
181
|
|
@@ -227,6 +238,14 @@ Bug Fixes:
|
|
227
238
|
returns `nil` or `''` so that you still get a useful message.
|
228
239
|
(Nick DeLuca)
|
229
240
|
|
241
|
+
### 2.99.2 / 2014-07-21
|
242
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.1...v2.99.2)
|
243
|
+
|
244
|
+
Enhancements:
|
245
|
+
|
246
|
+
* Warn about upcoming change to `#===` matching and `DateTime#===` behaviour.
|
247
|
+
(Jon Rowe, #735)
|
248
|
+
|
230
249
|
### 2.99.1 / 2014-06-12
|
231
250
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0...v2.99.1)
|
232
251
|
|
@@ -22,6 +22,8 @@ module RSpec
|
|
22
22
|
@block ||= block
|
23
23
|
@subject = subject
|
24
24
|
@expectation = expect
|
25
|
+
mock_proxy.ensure_implemented(@method_name)
|
26
|
+
|
25
27
|
expected_messages_received_in_order?
|
26
28
|
end
|
27
29
|
|
@@ -29,6 +31,7 @@ module RSpec
|
|
29
31
|
@subject = subject
|
30
32
|
ensure_count_unconstrained
|
31
33
|
@expectation = expect.never
|
34
|
+
mock_proxy.ensure_implemented(@method_name)
|
32
35
|
expected_messages_received_in_order?
|
33
36
|
end
|
34
37
|
|
data/lib/rspec/mocks/proxy.rb
CHANGED
data/lib/rspec/mocks/syntax.rb
CHANGED
@@ -202,97 +202,99 @@ module RSpec
|
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
-
|
206
|
-
#
|
207
|
-
# that
|
208
|
-
#
|
209
|
-
#
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
205
|
+
if defined?(BasicObject)
|
206
|
+
# The legacy `:should` syntax adds the following methods directly to
|
207
|
+
# `BasicObject` so that they are available off of any object. Note, however,
|
208
|
+
# that this syntax does not always play nice with delegate/proxy objects.
|
209
|
+
# We recommend you use the non-monkeypatching `:expect` syntax instead.
|
210
|
+
# @see Class
|
211
|
+
class BasicObject
|
212
|
+
# @method should_receive
|
213
|
+
# Sets an expectation that this object should receive a message before
|
214
|
+
# the end of the example.
|
215
|
+
#
|
216
|
+
# @example
|
217
|
+
#
|
218
|
+
# logger = double('logger')
|
219
|
+
# thing_that_logs = ThingThatLogs.new(logger)
|
220
|
+
# logger.should_receive(:log)
|
221
|
+
# thing_that_logs.do_something_that_logs_a_message
|
222
|
+
#
|
223
|
+
# @note This is only available when you have enabled the `should` syntax.
|
224
|
+
# @see RSpec::Mocks::ExampleMethods#expect
|
225
|
+
|
226
|
+
# @method should_not_receive
|
227
|
+
# Sets and expectation that this object should _not_ receive a message
|
228
|
+
# during this example.
|
229
|
+
# @see RSpec::Mocks::ExampleMethods#expect
|
230
|
+
|
231
|
+
# @method stub
|
232
|
+
# Tells the object to respond to the message with the specified value.
|
233
|
+
#
|
234
|
+
# @example
|
235
|
+
#
|
236
|
+
# counter.stub(:count).and_return(37)
|
237
|
+
# counter.stub(:count => 37)
|
238
|
+
# counter.stub(:count) { 37 }
|
239
|
+
#
|
240
|
+
# @note This is only available when you have enabled the `should` syntax.
|
241
|
+
# @see RSpec::Mocks::ExampleMethods#allow
|
242
|
+
|
243
|
+
# @method unstub
|
244
|
+
# Removes a stub. On a double, the object will no longer respond to
|
245
|
+
# `message`. On a real object, the original method (if it exists) is
|
246
|
+
# restored.
|
247
|
+
#
|
248
|
+
# This is rarely used, but can be useful when a stub is set up during a
|
249
|
+
# shared `before` hook for the common case, but you want to replace it
|
250
|
+
# for a special case.
|
251
|
+
#
|
252
|
+
# @note This is only available when you have enabled the `should` syntax.
|
253
|
+
|
254
|
+
# @method stub_chain
|
255
|
+
# @overload stub_chain(method1, method2)
|
256
|
+
# @overload stub_chain("method1.method2")
|
257
|
+
# @overload stub_chain(method1, method_to_value_hash)
|
258
|
+
#
|
259
|
+
# Stubs a chain of methods.
|
260
|
+
#
|
261
|
+
# ## Warning:
|
262
|
+
#
|
263
|
+
# Chains can be arbitrarily long, which makes it quite painless to
|
264
|
+
# violate the Law of Demeter in violent ways, so you should consider any
|
265
|
+
# use of `stub_chain` a code smell. Even though not all code smells
|
266
|
+
# indicate real problems (think fluent interfaces), `stub_chain` still
|
267
|
+
# results in brittle examples. For example, if you write
|
268
|
+
# `foo.stub_chain(:bar, :baz => 37)` in a spec and then the
|
269
|
+
# implementation calls `foo.baz.bar`, the stub will not work.
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
#
|
273
|
+
# double.stub_chain("foo.bar") { :baz }
|
274
|
+
# double.stub_chain(:foo, :bar => :baz)
|
275
|
+
# double.stub_chain(:foo, :bar) { :baz }
|
276
|
+
#
|
277
|
+
# # Given any of ^^ these three forms ^^:
|
278
|
+
# double.foo.bar # => :baz
|
279
|
+
#
|
280
|
+
# # Common use in Rails/ActiveRecord:
|
281
|
+
# Article.stub_chain("recent.published") { [Article.new] }
|
282
|
+
#
|
283
|
+
# @note This is only available when you have enabled the `should` syntax.
|
284
|
+
# @see RSpec::Mocks::ExampleMethods#receive_message_chain
|
285
|
+
|
286
|
+
# @method as_null_object
|
287
|
+
# Tells the object to respond to all messages. If specific stub values
|
288
|
+
# are declared, they'll work as expected. If not, the receiver is
|
289
|
+
# returned.
|
290
|
+
#
|
291
|
+
# @note This is only available when you have enabled the `should` syntax.
|
292
|
+
|
293
|
+
# @method null_object?
|
294
|
+
# Returns true if this object has received `as_null_object`
|
295
|
+
#
|
296
|
+
# @note This is only available when you have enabled the `should` syntax.
|
297
|
+
end
|
296
298
|
end
|
297
299
|
|
298
300
|
# The legacy `:should` syntax adds the `any_instance` to `Class`.
|
@@ -119,6 +119,11 @@ module RSpec
|
|
119
119
|
return false unless @__expired
|
120
120
|
ErrorGenerator.new(self, @name).raise_expired_test_double_error
|
121
121
|
end
|
122
|
+
|
123
|
+
def initialize_copy(other)
|
124
|
+
as_null_object if other.null_object?
|
125
|
+
super
|
126
|
+
end
|
122
127
|
end
|
123
128
|
|
124
129
|
# A generic test double object. `double`, `instance_double` and friends
|
data/lib/rspec/mocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
1yHC1AcSYpvi2dAbOiHT5iQF+krm4wse8KctXgTNnjMsHEoGKulJS2/sZl90jcCz
|
34
34
|
muA=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2014-
|
36
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec-support
|
@@ -179,6 +179,6 @@ rubyforge_project: rspec
|
|
179
179
|
rubygems_version: 2.2.2
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
|
-
summary: rspec-mocks-3.0.
|
182
|
+
summary: rspec-mocks-3.0.3
|
183
183
|
test_files: []
|
184
184
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|