Skip to content

Commit

Permalink
Spec double() stubs hash in different syntax modes.
Browse files Browse the repository at this point in the history
This tests a regression referenced in #306 where disabling the :should
syntax raised errors when a stubs hash was passed to double().
  • Loading branch information
pda authored and Sam Phippen committed Jun 13, 2013
1 parent c73cd35 commit 62d49cb
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions spec/rspec/mocks/test_double_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ def use; end
expect { double.foo }.to raise_error(/Mock "MyDouble" received/)
end

it 'stubs the methods passed in the stubs hash' do
double = Module.new do
TestDouble.extend_onto(self, "MyDouble", :a => 5, :b => 10)
[[:should, :expect], [:expect], [:should]].each do |syntax|
context "with syntax #{syntax.inspect}" do
include_context "with syntax", syntax
it 'stubs the methods passed in the stubs hash' do
double = Module.new do
TestDouble.extend_onto(self, "MyDouble", :a => 5, :b => 10)
end

expect(double.a).to eq(5)
expect(double.b).to eq(10)
end
end

expect(double.a).to eq(5)
expect(double.b).to eq(10)
end

it 'indicates what type of test double it is in error messages' do
Expand Down

0 comments on commit 62d49cb

Please sign in to comment.