Skip to content

Instantly share code, notes, and snippets.

@ilpoldo
Forked from MarkPochert/gist:723628
Created December 1, 2010 15:28
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 ilpoldo/723630 to your computer and use it in GitHub Desktop.
Save ilpoldo/723630 to your computer and use it in GitHub Desktop.
@invalid_user = Factory.create(:user)
@invalid_user.stub(:valid?).and_return(false)
User.stub(:new).and_return(@invaild_user)
post :create, :user_name => "some user name that won't even be used"
@ilpoldo
Copy link
Author

ilpoldo commented Dec 1, 2010

https://gist.github.com/723630/5906238dfb0c973a89fc15727eab0dddfe40a21a#LID4

I did miss it completely: you will not be able to pass a whole ruby object through the post parameters I think.
My guess is that somewhere in the way the mock request is processed that thing will be smashed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment