Skip to content

Instantly share code, notes, and snippets.

@drewB
Created April 1, 2010 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewB/352305 to your computer and use it in GitHub Desktop.
Save drewB/352305 to your computer and use it in GitHub Desktop.
user = mock_model(User)
User.stub!(:find).at_least(1).and_return do |id|
if id == mock_user.id.to_s
user
else
User.find_by_id(id)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment