Skip to content

Instantly share code, notes, and snippets.

@pd
Created March 9, 2009 14:57
Show Gist options
  • Save pd/76336 to your computer and use it in GitHub Desktop.
Save pd/76336 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'spec'
class Foo
def bar
end
end
describe 'multistubs' do
it "should raise then return" do
foo = Foo.new
foo.stub!(:bar => 12)
foo.should_receive(:bar).exactly(1).times.and_raise(ArgumentError)
lambda { foo.bar }.should raise_error(ArgumentError)
foo.bar.should == 12
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment