Created
November 26, 2012 17:40
Revisions
-
devpuppy created this gist
Nov 26, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # as a one-liner to use in an rspec example @user.stub(:trebuchet).and_return(double(@user.trebuchet, :launch? => true)) # more verbose example it "should stub user.trebuchet" do @user = Factory(:user) @user.trebuchet.launch?("something ridiculous").should be_false enthusiastic_trebuchet = double(@user.trebuchet, :launch? => true) @user.stub(:trebuchet).and_return(enthusiastic_trebuchet) @user.trebuchet.launch?("something ridiculous").should be_true end