Skip to content

Instantly share code, notes, and snippets.

@chischaschos
Created March 3, 2011 21:16
Show Gist options
  • Save chischaschos/853602 to your computer and use it in GitHub Desktop.
Save chischaschos/853602 to your computer and use it in GitHub Desktop.
RSpec stubbing all instances from a User
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