Created
November 15, 2010 14:17
-
-
Save jszmajda/700396 to your computer and use it in GitHub Desktop.
how to handle conflicting stubbing requirements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Bar" do | |
it "should not bar" do | |
lambda { | |
"foo".bar | |
}.should raise_exception | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Foo" do | |
before :all do | |
# breaks other test: String.any_instance.stubs(:bar).returns("Hey, bar!") | |
@mystring = "yay" | |
@mystring.stubs(:bar).returns("Hey, bar!") | |
end | |
it "should bar" do | |
@mystring.bar.should == "Hey, bar!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment