Hello community,
here is the log from the commit of package rubygem-rspec-mocks for
openSUSE:Factory checked in at 2015-03-01 14:57:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rspec-mocks (Old)
and /work/SRC/openSUSE:Factory/.rubygem-rspec-mocks.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rspec-mocks"
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rspec-mocks/rubygem-rspec-mocks.changes
2015-02-08 13:03:27.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-rspec-mocks.new/rubygem-rspec-mocks.changes
2015-03-01 14:57:59.000000000 +0100
@@ -1,0 +2,14 @@
+Thu Feb 26 05:33:55 UTC 2015 - [email protected]
+
+- updated to version 3.2.1
+ Bug Fixes:
+
+ * Add missing `rspec/support/differ` require so that rspec-mocks can be
+ used w/o rspec-expectations (which also loads the differ and hided the
+ fact we forgot to require it). (Myron Marston, #893)
+ * Revert tracking of received arg mutation (added in 3.2.0 to provide an
+ error in a situation we can't support) as our implementation has side
+ effects on non-standard objects and there's no solution we could come
+ up with that always works. (Myron Marston, #900)
+
+-------------------------------------------------------------------
Old:
----
rspec-mocks-3.2.0.gem
New:
----
rspec-mocks-3.2.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-rspec-mocks.spec ++++++
--- /var/tmp/diff_new_pack.T18GLa/_old 2015-03-01 14:58:00.000000000 +0100
+++ /var/tmp/diff_new_pack.T18GLa/_new 2015-03-01 14:58:00.000000000 +0100
@@ -24,7 +24,7 @@
#
Name: rubygem-rspec-mocks
-Version: 3.2.0
+Version: 3.2.1
Release: 0
%define mod_name rspec-mocks
%define mod_full_name %{mod_name}-%{version}
++++++ rspec-mocks-3.2.0.gem -> rspec-mocks-3.2.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Changelog.md new/Changelog.md
--- old/Changelog.md 2015-02-03 16:33:49.000000000 +0100
+++ new/Changelog.md 2015-02-24 04:24:29.000000000 +0100
@@ -1,3 +1,16 @@
+### 3.2.1 / 2015-02-23
+[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.2.0...v3.2.1)
+
+Bug Fixes:
+
+* Add missing `rspec/support/differ` require so that rspec-mocks can be
+ used w/o rspec-expectations (which also loads the differ and hided the
+ fact we forgot to require it). (Myron Marston, #893)
+* Revert tracking of received arg mutation (added in 3.2.0 to provide an
+ error in a situation we can't support) as our implementation has side
+ effects on non-standard objects and there's no solution we could come
+ up with that always works. (Myron Marston, #900)
+
### 3.2.0 / 2015-02-03
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.1.3...v3.2.0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2015-02-03 16:33:49.000000000 +0100
+++ new/README.md 2015-02-24 04:24:29.000000000 +0100
@@ -136,8 +136,7 @@
object_spy("Invitation") # => same as
`object_double("Invitation").as_null_object`
```
-Stubbing and verifying messages received in this way implements the Test Spy
-pattern.
+Verifying messages received in this way implements the Test Spy pattern.
```ruby
invitation = spy('invitation')
@@ -157,6 +156,20 @@
expect(invitation.accept).to eq(true)
```
+Note that `have_received(...).with(...)` is unable to work properly when
+passed arguments are mutated after the spy records the received message.
+For example, this does not work properly:
+
+```ruby
+greeter = spy("greeter")
+
+message = "Hello"
+greeter.greet_with(message)
+message << ", World"
+
+expect(greeter).to have_received(:greet_with).with("Hello")
+```
+
## Nomenclature
### Mock Objects and Test Stubs
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
Files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ
Files old/data.tar.gz.sig and new/data.tar.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/argument_matchers.rb
new/lib/rspec/mocks/argument_matchers.rb
--- old/lib/rspec/mocks/argument_matchers.rb 2015-02-03 16:33:49.000000000
+0100
+++ new/lib/rspec/mocks/argument_matchers.rb 2015-02-24 04:24:29.000000000
+0100
@@ -17,7 +17,6 @@
# Acts like an arg splat, matching any number of args at any point in an
arg list.
#
# @example
- #
# expect(object).to receive(:message).with(1, 2, any_args)
#
# # matches any of these:
@@ -31,7 +30,6 @@
# Matches any argument at all.
#
# @example
- #
# expect(object).to receive(:message).with(anything)
def anything
AnyArgMatcher::INSTANCE
@@ -40,7 +38,6 @@
# Matches no arguments.
#
# @example
- #
# expect(object).to receive(:message).with(no_args)
def no_args
NoArgsMatcher::INSTANCE
@@ -49,7 +46,6 @@
# Matches if the actual argument responds to the specified messages.
#
# @example
- #
# expect(object).to receive(:message).with(duck_type(:hello))
# expect(object).to receive(:message).with(duck_type(:hello, :goodbye))
def duck_type(*args)
@@ -59,7 +55,6 @@
# Matches a boolean value.
#
# @example
- #
# expect(object).to receive(:message).with(boolean())
def boolean
BooleanMatcher::INSTANCE
@@ -69,7 +64,6 @@
# Ignores any additional keys.
#
# @example
- #
# expect(object).to receive(:message).with(hash_including(:key => val))
# expect(object).to receive(:message).with(hash_including(:key))
# expect(object).to receive(:message).with(hash_including(:key, :key2
=> val2))
@@ -81,7 +75,6 @@
# Ignores duplicates and additional values
#
# @example
- #
# expect(object).to receive(:message).with(array_including(1,2,3))
# expect(object).to receive(:message).with(array_including([1,2,3]))
def array_including(*args)
@@ -92,7 +85,6 @@
# Matches a hash that doesn't include the specified key(s) or key/value.
#
# @example
- #
# expect(object).to receive(:message).with(hash_excluding(:key => val))
# expect(object).to receive(:message).with(hash_excluding(:key))
# expect(object).to receive(:message).with(hash_excluding(:key, :key2
=> :val2))
@@ -105,7 +97,6 @@
# Matches if `arg.instance_of?(klass)`
#
# @example
- #
# expect(object).to receive(:message).with(instance_of(Thing))
def instance_of(klass)
InstanceOf.new(klass)
@@ -114,8 +105,8 @@
alias_method :an_instance_of, :instance_of
# Matches if `arg.kind_of?(klass)`
- # @example
#
+ # @example
# expect(object).to receive(:message).with(kind_of(Thing))
def kind_of(klass)
KindOf.new(klass)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/configuration.rb
new/lib/rspec/mocks/configuration.rb
--- old/lib/rspec/mocks/configuration.rb 2015-02-03 16:33:49.000000000
+0100
+++ new/lib/rspec/mocks/configuration.rb 2015-02-24 04:24:29.000000000
+0100
@@ -19,7 +19,6 @@
# Defaults to `true`.
#
# @example
- #
# RSpec.configure do |rspec|
# rspec.mock_with :rspec do |mocks|
# mocks.yield_receiver_to_any_instance_implementation_blocks =
false
@@ -35,7 +34,6 @@
# the process.
#
# @example
- #
# RSpec.configure do |rspec|
# rspec.mock_with :rspec do |mocks|
# mocks.add_stub_and_should_receive_to Delegator
@@ -55,7 +53,6 @@
# disable `expect` syntax.
#
# @example
- #
# RSpec.configure do |rspec|
# rspec.mock_with :rspec do |mocks|
# mocks.syntax = [:expect, :should]
@@ -81,7 +78,6 @@
# that are enabled.
#
# @example
- #
# unless RSpec::Mocks.configuration.syntax.include?(:expect)
# raise "this RSpec extension gem requires the rspec-mocks `:expect`
syntax"
# end
@@ -107,7 +103,6 @@
# Provides a way to perform customisations when verifying doubles.
#
# @example
- #
# RSpec::Mocks.configuration.when_declaring_verifying_double do |ref|
# ref.some_method!
# end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/error_generator.rb
new/lib/rspec/mocks/error_generator.rb
--- old/lib/rspec/mocks/error_generator.rb 2015-02-03 16:33:49.000000000
+0100
+++ new/lib/rspec/mocks/error_generator.rb 2015-02-24 04:24:29.000000000
+0100
@@ -1,3 +1,5 @@
+RSpec::Support.require_rspec_support 'differ'
+
module RSpec
module Mocks
# Raised when a message expectation is not satisfied.
@@ -18,6 +20,9 @@
# Raised for situations that RSpec cannot support due to mutations made
# externally on arguments that RSpec is holding onto to use for later
# comparisons.
+ #
+ # @deprecated We no longer raise this error but the constant remains until
+ # RSpec 4 for SemVer reasons.
CannotSupportArgMutationsError = Class.new(StandardError)
# @private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/example_methods.rb
new/lib/rspec/mocks/example_methods.rb
--- old/lib/rspec/mocks/example_methods.rb 2015-02-03 16:33:49.000000000
+0100
+++ new/lib/rspec/mocks/example_methods.rb 2015-02-24 04:24:29.000000000
+0100
@@ -24,7 +24,6 @@
# hash of message/return-value pairs.
#
# @example
- #
# book = double("book", :title => "The RSpec Book")
# book.title #=> "The RSpec Book"
#
@@ -219,7 +218,6 @@
# @return [Object] the stubbed value of the constant
#
# @example
- #
# stub_const("MyClass", Class.new) # => Replaces (or defines) MyClass
with a new class object.
# stub_const("SomeModel::PER_PAGE", 5) # => Sets SomeModel::PER_PAGE
to 5.
#
@@ -253,7 +251,6 @@
# The current constant scoping at the point of call is not considered.
#
# @example
- #
# hide_const("MyClass") # => MyClass is now an undefined constant
def hide_const(constant_name)
ConstantMutator.hide(constant_name)
@@ -271,13 +268,15 @@
# called.
#
# @example
- #
# invitation = double('invitation', accept: true)
# user.accept_invitation(invitation)
# expect(invitation).to have_received(:accept)
#
# # You can also use most message expectations:
# expect(invitation).to have_received(:accept).with(mailer).once
+ #
+ # @note `have_received(...).with(...)` is unable to work properly when
+ # passed arguments are mutated after the spy records the received
message.
def have_received(method_name, &block)
Matchers::HaveReceived.new(method_name, &block)
end
@@ -287,7 +286,6 @@
# on it.
#
# @example
- #
# expect(obj).to receive(:foo).with(5).and_return(:return_value)
#
# @note This method is usually provided by rspec-expectations. However,
@@ -300,7 +298,6 @@
# on it.
#
# @example
- #
# allow(dbl).to receive(:foo).with(5).and_return(:return_value)
#
# @note If you disable the `:expect` syntax this method will be
undefined.
@@ -310,7 +307,6 @@
# on instances of it.
#
# @example
- #
# expect_any_instance_of(MyClass).to receive(:foo)
#
# @note If you disable the `:expect` syntax this method will be
undefined.
@@ -320,7 +316,6 @@
# on instances of it.
#
# @example
- #
# allow_any_instance_of(MyClass).to receive(:foo)
#
# @note This is only available when you have enabled the `expect` syntax.
@@ -333,7 +328,6 @@
# times, and configure how the object should respond to the message.
#
# @example
- #
# expect(obj).to receive(:hello).with("world").exactly(3).times
#
# @note If you disable the `:expect` syntax this method will be
undefined.
@@ -346,7 +340,6 @@
# interface.
#
# @example
- #
# allow(obj).to receive_messages(:speak => "Hello World")
# allow(obj).to receive_messages(:speak => "Hello", :meow => "Meow")
#
@@ -370,16 +363,15 @@
# implementation calls `foo.baz.bar`, the stub will not work.
#
# @example
+ # allow(double).to receive_message_chain("foo.bar") { :baz }
+ # allow(double).to receive_message_chain(:foo, :bar => :baz)
+ # allow(double).to receive_message_chain(:foo, :bar) { :baz }
#
- # allow(double).to receive_message_chain("foo.bar") { :baz }
- # allow(double).to receive_message_chain(:foo, :bar => :baz)
- # allow(double).to receive_message_chain(:foo, :bar) { :baz }
- #
- # # Given any of ^^ these three forms ^^:
- # double.foo.bar # => :baz
+ # # Given any of ^^ these three forms ^^:
+ # double.foo.bar # => :baz
#
- # # Common use in Rails/ActiveRecord:
- # allow(Article).to receive_message_chain("recent.published") {
[Article.new] }
+ # # Common use in Rails/ActiveRecord:
+ # allow(Article).to receive_message_chain("recent.published") {
[Article.new] }
#
# @note If you disable the `:expect` syntax this method will be
undefined.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/message_expectation.rb
new/lib/rspec/mocks/message_expectation.rb
--- old/lib/rspec/mocks/message_expectation.rb 2015-02-03 16:33:49.000000000
+0100
+++ new/lib/rspec/mocks/message_expectation.rb 2015-02-24 04:24:30.000000000
+0100
@@ -510,17 +510,6 @@
@actual_received_count += 1
end
- def fail_if_problematic_received_arg_mutations(received_arg_list)
- return if @argument_list_matcher == ArgumentListMatcher::MATCH_ALL
- return unless received_arg_list.has_mutations?
-
- raise CannotSupportArgMutationsError,
- "`have_received(...).with(...)` cannot be used when received "
\
- "message args have later been mutated. You can use a normal " \
- "message expectation (`expect(...).to receive(...).with(...)`)
" \
- "instead."
- end
-
private
def invoke_incrementing_actual_calls_by(increment, allowed_to_fail,
parent_stub, *args, &block)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/proxy.rb new/lib/rspec/mocks/proxy.rb
--- old/lib/rspec/mocks/proxy.rb 2015-02-03 16:33:49.000000000 +0100
+++ new/lib/rspec/mocks/proxy.rb 2015-02-24 04:24:30.000000000 +0100
@@ -88,12 +88,7 @@
@error_generator.raise_expectation_on_unstubbed_method(expected_method_name)
end
- @messages_received.each do |(actual_method_name, received_arg_list, _)|
- if expectation.message == actual_method_name
-
expectation.fail_if_problematic_received_arg_mutations(received_arg_list)
- end
-
- args = received_arg_list.args
+ @messages_received.each do |(actual_method_name, args, _)|
next unless expectation.matches?(actual_method_name, *args)
expectation.safe_invoke(nil)
@@ -103,8 +98,7 @@
# @private
def check_for_unexpected_arguments(expectation)
- @messages_received.each do |(method_name, received_arg_list, _)|
- args = received_arg_list.args
+ @messages_received.each do |(method_name, args, _)|
next unless expectation.matches_name_but_not_args(method_name, *args)
raise_unexpected_message_args_error(expectation, *args)
@@ -144,11 +138,7 @@
# @private
def received_message?(method_name, *args, &block)
- @messages_received.any? do |(received_method_name, received_arg_list,
received_block)|
- method_name == received_method_name &&
- args == received_arg_list.args &&
- block == received_block
- end
+ @messages_received.any? { |array| array == [method_name, args, block] }
end
# @private
@@ -159,35 +149,7 @@
# @private
def record_message_received(message, *args, &block)
@order_group.invoked SpecificMessage.new(object, message, args)
- @messages_received << [message, ReceivedArgList.new(args), block]
- end
-
- class ReceivedArgList
- attr_reader :args
-
- def initialize(args)
- @args = args
- @original_hash = hash_of(args)
- end
-
- def has_mutations?
- @original_hash != hash_of(args)
- end
-
- private
-
- def hash_of(arg)
- arg.hash
- rescue Exception
- # While `Object#hash` is a built-in ruby method that we expect args
to
- # support, there's no guarantee that all args will. For example, a
- # `BasicObject` instance will raise a `NoMethodError`. Given that
- # we use the hash only to advise the user of a rare case we don't
- # support involving mutations, it seems better to ignore this error
- # and use a static value in its place (which will make us assume no
- # mutation has occurred).
- :failed_to_get_hash
- end
+ @messages_received << [message, args, block]
end
# @private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/syntax.rb
new/lib/rspec/mocks/syntax.rb
--- old/lib/rspec/mocks/syntax.rb 2015-02-03 16:33:49.000000000 +0100
+++ new/lib/rspec/mocks/syntax.rb 2015-02-24 04:24:30.000000000 +0100
@@ -214,11 +214,10 @@
# the end of the example.
#
# @example
- #
- # logger = double('logger')
- # thing_that_logs = ThingThatLogs.new(logger)
- # logger.should_receive(:log)
- # thing_that_logs.do_something_that_logs_a_message
+ # logger = double('logger')
+ # thing_that_logs = ThingThatLogs.new(logger)
+ # logger.should_receive(:log)
+ # thing_that_logs.do_something_that_logs_a_message
#
# @note This is only available when you have enabled the `should` syntax.
# @see RSpec::Mocks::ExampleMethods#expect
@@ -232,10 +231,9 @@
# Tells the object to respond to the message with the specified value.
#
# @example
- #
- # counter.stub(:count).and_return(37)
- # counter.stub(:count => 37)
- # counter.stub(:count) { 37 }
+ # counter.stub(:count).and_return(37)
+ # counter.stub(:count => 37)
+ # counter.stub(:count) { 37 }
#
# @note This is only available when you have enabled the `should` syntax.
# @see RSpec::Mocks::ExampleMethods#allow
@@ -269,10 +267,9 @@
# implementation calls `foo.baz.bar`, the stub will not work.
#
# @example
- #
- # double.stub_chain("foo.bar") { :baz }
- # double.stub_chain(:foo, :bar => :baz)
- # double.stub_chain(:foo, :bar) { :baz }
+ # double.stub_chain("foo.bar") { :baz }
+ # double.stub_chain(:foo, :bar => :baz)
+ # double.stub_chain(:foo, :bar) { :baz }
#
# # Given any of ^^ these three forms ^^:
# double.foo.bar # => :baz
@@ -311,15 +308,14 @@
# class.
#
# @example
+ # Car.any_instance.should_receive(:go)
+ # race = Race.new
+ # race.cars << Car.new
+ # race.go # assuming this delegates to all of its cars
+ # # this example would pass
#
- # Car.any_instance.should_receive(:go)
- # race = Race.new
- # race.cars << Car.new
- # race.go # assuming this delegates to all of its cars
- # # this example would pass
- #
- # Account.any_instance.stub(:balance) { Money.new(:USD, 25) }
- # Account.new.balance # => Money.new(:USD, 25))
+ # Account.any_instance.stub(:balance) { Money.new(:USD, 25) }
+ # Account.new.balance # => Money.new(:USD, 25))
#
# @return [Recorder]
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec/mocks/version.rb
new/lib/rspec/mocks/version.rb
--- old/lib/rspec/mocks/version.rb 2015-02-03 16:33:49.000000000 +0100
+++ new/lib/rspec/mocks/version.rb 2015-02-24 04:24:30.000000000 +0100
@@ -3,7 +3,7 @@
# Version information for RSpec mocks.
module Version
# Version of RSpec mocks currently in use in SemVer format.
- STRING = '3.2.0'
+ STRING = '3.2.1'
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-02-03 16:33:49.000000000 +0100
+++ new/metadata 2015-02-24 04:24:29.000000000 +0100
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: rspec-mocks
version: !ruby/object:Gem::Version
- version: 3.2.0
+ version: 3.2.1
platform: ruby
authors:
- Steven Baker
@@ -45,7 +45,7 @@
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
F3MdtaDehhjC
-----END CERTIFICATE-----
-date: 2015-02-03 00:00:00.000000000 Z
+date: 2015-02-24 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rspec-support
@@ -208,9 +208,9 @@
version: '0'
requirements: []
rubyforge_project: rspec
-rubygems_version: 2.2.2
+rubygems_version: 2.4.5
signing_key:
specification_version: 4
-summary: rspec-mocks-3.2.0
+summary: rspec-mocks-3.2.1
test_files: []
has_rdoc:
Files old/metadata.gz.sig and new/metadata.gz.sig differ
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]