Skip to content

Commit

Permalink
Merge pull request #711 from rspec/fix-710
Browse files Browse the repository at this point in the history
Fix edge case that triggered “can't add a new key into hash during iteration"
  • Loading branch information
myronmarston committed Jun 12, 2014
2 parents e7af397 + a9d2100 commit 1781fb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/mocks/space.rb
Expand Up @@ -65,7 +65,7 @@ def new_scope
end

def verify_all
proxies.each_value { |proxy| proxy.verify }
proxies.values.each { |proxy| proxy.verify }
any_instance_recorders.each_value { |recorder| recorder.verify }
end

Expand Down
9 changes: 9 additions & 0 deletions spec/rspec/mocks/double_spec.rb
Expand Up @@ -35,6 +35,15 @@ module Mocks
expect { reset dbl }.not_to raise_error
end

it "generates the correct error when an unfulfilled expectation uses an unused double as a `with` argument" do
expect {
a = double('a')
b = double('b')
expect(a).to receive(:append).with(b)
verify_all
}.to raise_error(RSpec::Mocks::MockExpectationError)
end

it 'allows string representation of methods in constructor' do
dbl = double('foo' => 1)
expect(dbl.foo).to eq(1)
Expand Down

0 comments on commit 1781fb3

Please sign in to comment.