Created
March 3, 2011 21:16
-
-
Save chischaschos/853602 to your computer and use it in GitHub Desktop.
RSpec stubbing all instances from a User
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
new_method = User.method(:new) | |
User.stub(:new).and_return do |*args| | |
instance = new_method.call *args | |
instance.stub(:project_changes).with(@project.to_param).and_return(@changes_array) | |
instance | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment