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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1bc4975e669df2055273dea6d7d5408f8fdb7c8
4
- data.tar.gz: 1c8ed12a97b2da9679629fd7e5d13cf9653fae8f
3
+ metadata.gz: fce3b18da2e05ea86c3651d08744828ea2c4664f
4
+ data.tar.gz: f6cfa7626887ee4673812b7d475080ba4a722beb
5
5
  SHA512:
6
- metadata.gz: e50b72cd647cca2f11399a0449a552bcfba4573239a61182a5820443695f29bcba5a332083ffbcb42e56b0a45dcb103c26a85aff9acfe81f2f49710c8b8486b1
7
- data.tar.gz: 229af01a4b572a4eded313234f40d650f674f7ceb0b162210d7187a58861fd3c971d1bca5423185733f188ae8454c7053dde5009dc899010a84a00a6f3b43807
6
+ metadata.gz: 38034eb9854b7aed1466e0d93a314c7565c15f24e1acdcf9dd07b65304569a75774fa8a589de05f3769160c3dee0623262ac93909a0423a54f2092cc7352143c
7
+ data.tar.gz: fe6bbe3f040c817df0ec44670e53874e740e1c68af6e718d7a711e5cbfdd1dfb88c4fda5740d8a394fea7f0af8d15281f59353be221670e9f7d64e950d2e8ac8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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.0...v3.0.0.beta1)
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
 
@@ -8,6 +8,11 @@ module RSpec
8
8
  end
9
9
  end
10
10
 
11
+ # @private
12
+ def ensure_implemented(*args)
13
+ # noop for basic proxies, see VerifyingProxy for behaviour.
14
+ end
15
+
11
16
  # @private
12
17
  def initialize(object, order_group, name=nil, options={})
13
18
  @object = object
@@ -202,97 +202,99 @@ module RSpec
202
202
  end
203
203
  end
204
204
 
205
- # The legacy `:should` syntax adds the following methods directly to
206
- # `BasicObject` so that they are available off of any object. Note, however,
207
- # that this syntax does not always play nice with delegate/proxy objects.
208
- # We recommend you use the non-monkeypatching `:expect` syntax instead.
209
- # @see Class
210
- class BasicObject
211
- # @method should_receive
212
- # Sets an expectation that this object should receive a message before
213
- # the end of the example.
214
- #
215
- # @example
216
- #
217
- # logger = double('logger')
218
- # thing_that_logs = ThingThatLogs.new(logger)
219
- # logger.should_receive(:log)
220
- # thing_that_logs.do_something_that_logs_a_message
221
- #
222
- # @note This is only available when you have enabled the `should` syntax.
223
- # @see RSpec::Mocks::ExampleMethods#expect
224
-
225
- # @method should_not_receive
226
- # Sets and expectation that this object should _not_ receive a message
227
- # during this example.
228
- # @see RSpec::Mocks::ExampleMethods#expect
229
-
230
- # @method stub
231
- # Tells the object to respond to the message with the specified value.
232
- #
233
- # @example
234
- #
235
- # counter.stub(:count).and_return(37)
236
- # counter.stub(:count => 37)
237
- # counter.stub(:count) { 37 }
238
- #
239
- # @note This is only available when you have enabled the `should` syntax.
240
- # @see RSpec::Mocks::ExampleMethods#allow
241
-
242
- # @method unstub
243
- # Removes a stub. On a double, the object will no longer respond to
244
- # `message`. On a real object, the original method (if it exists) is
245
- # restored.
246
- #
247
- # This is rarely used, but can be useful when a stub is set up during a
248
- # shared `before` hook for the common case, but you want to replace it
249
- # for a special case.
250
- #
251
- # @note This is only available when you have enabled the `should` syntax.
252
-
253
- # @method stub_chain
254
- # @overload stub_chain(method1, method2)
255
- # @overload stub_chain("method1.method2")
256
- # @overload stub_chain(method1, method_to_value_hash)
257
- #
258
- # Stubs a chain of methods.
259
- #
260
- # ## Warning:
261
- #
262
- # Chains can be arbitrarily long, which makes it quite painless to
263
- # violate the Law of Demeter in violent ways, so you should consider any
264
- # use of `stub_chain` a code smell. Even though not all code smells
265
- # indicate real problems (think fluent interfaces), `stub_chain` still
266
- # results in brittle examples. For example, if you write
267
- # `foo.stub_chain(:bar, :baz => 37)` in a spec and then the
268
- # implementation calls `foo.baz.bar`, the stub will not work.
269
- #
270
- # @example
271
- #
272
- # double.stub_chain("foo.bar") { :baz }
273
- # double.stub_chain(:foo, :bar => :baz)
274
- # double.stub_chain(:foo, :bar) { :baz }
275
- #
276
- # # Given any of ^^ these three forms ^^:
277
- # double.foo.bar # => :baz
278
- #
279
- # # Common use in Rails/ActiveRecord:
280
- # Article.stub_chain("recent.published") { [Article.new] }
281
- #
282
- # @note This is only available when you have enabled the `should` syntax.
283
- # @see RSpec::Mocks::ExampleMethods#receive_message_chain
284
-
285
- # @method as_null_object
286
- # Tells the object to respond to all messages. If specific stub values
287
- # are declared, they'll work as expected. If not, the receiver is
288
- # returned.
289
- #
290
- # @note This is only available when you have enabled the `should` syntax.
291
-
292
- # @method null_object?
293
- # Returns true if this object has received `as_null_object`
294
- #
295
- # @note This is only available when you have enabled the `should` syntax.
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
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec mocks.
4
4
  module Version
5
5
  # Version of RSpec mocks currently in use in SemVer format.
6
- STRING = '3.0.2'
6
+ STRING = '3.0.3'
7
7
  end
8
8
  end
9
9
  end
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.2
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-06-20 00:00:00.000000000 Z
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.2
182
+ summary: rspec-mocks-3.0.3
183
183
  test_files: []
184
184
  has_rdoc:
metadata.gz.sig CHANGED
Binary file