Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

can assert on non-block arguments when method is called with a block #21

Merged
merged 1 commit into from

2 participants

@alenia
Collaborator

A line in the matcher prevented assertions on the arguments of a method that was called with a block.

Daniela Wellisz can assert on non-block arguments when method is called with a block
Conflicts:
	lib/rspec-spies.rb
	spec/rspec-spies_spec.rb
6484d16
@MDaubs MDaubs referenced this pull request from a commit
@MDaubs MDaubs Manually merge #21, non-block arguments fix.
Conflicts:
	lib/rspec-spies.rb
	spec/rspec-spies_spec.rb
e121da5
@MDaubs MDaubs merged commit 6484d16 into technicalpickles:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 20, 2013
  1. can assert on non-block arguments when method is called with a block

    Daniela Wellisz authored Daniela Wellisz and Lars Petrus committed
    Conflicts:
    	lib/rspec-spies.rb
    	spec/rspec-spies_spec.rb
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +0 −1  lib/rspec-spies.rb
  2. +8 −0 spec/rspec-spies_spec.rb
View
1  lib/rspec-spies.rb
@@ -38,7 +38,6 @@ def visibility_for_method
received_method_name, received_args, received_block = *message
result = (received_method_name == method_name)
result &&= argument_expectation_class.new(@args || any_args).args_match?(received_args)
- result &&= (received_block == block)
end
end
View
8 spec/rspec-spies_spec.rb
@@ -37,6 +37,14 @@ module Matchers
have_received(:slice).with(hash_including({ :foo => :baz })).matches?(@object).should be_false
end
+ it "matches if third argument is a block" do
+ @object.stub!(:slice)
+ @object.slice(5) do; end
+
+ have_received(:slice).with(5).matches?(@object).should be_true
+ have_received(:slice).with(5,anything).matches?(@object).should be_false
+ end
+
it "does not match if method is called with incorrect args" do
@object.stub!(:slice)
@object.slice(3)
Something went wrong with that request. Please try again.