Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

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

Merged
merged 1 commit into from Mar 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/rspec-spies.rb
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions spec/rspec-spies_spec.rb
Expand Up @@ -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)
Expand Down