Chris Spears Dev
Blog about programming and computer graphics!
Thursday, December 5, 2013
Stubbing Out A User For Your Rspec Test
How to stub out a user when testing a controller with rspec:
# for controllers
user = User.create(:name => 'user@example.com', :password => 'caplin')
ApplicationController.stub(:current_user).and_return(user)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment