Skip to content

Instantly share code, notes, and snippets.

@jsl
Created April 20, 2012 16:07
Show Gist options
  • Save jsl/2429938 to your computer and use it in GitHub Desktop.
Save jsl/2429938 to your computer and use it in GitHub Desktop.
Rspec test
require 'rspec'
module Dog
def self.bark
"Woof!"
end
end
describe "Rspec re-setting stubs on classes" do
it "should return 'Woof!'" do
Dog.bark.should == 'Woof!'
end
it "should return a stubbed value" do
Dog.stub(:bark).and_return('Bow wow')
Dog.bark.should == 'Bow wow'
end
it "should not reset the stub since it's not something that will be re-loaded between examples" do
Dog.bark.should == 'Woof!'
end
end
@jsl
Copy link
Author

jsl commented Apr 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment