Skip to content

Instantly share code, notes, and snippets.

@ihoka
Created October 13, 2009 17:48
Show Gist options
  • Save ihoka/209398 to your computer and use it in GitHub Desktop.
Save ihoka/209398 to your computer and use it in GitHub Desktop.
describe "handling DELETE destroy" do
before(:each) do
@user_session = mock_model(UserSession, :record => mock_model(User))
UserSession.stub!(:find).and_return(@user_session)
@user_session.stub!(:destroy)
end
def do_delete
delete :destroy
end
it "destroy the user session" do
@user_session.should_receive(:destroy)
do_delete
end
it "redirects to the home page" do
do_delete
flash[:notice].should == "Logout successful!"
response.should redirect_to(root_path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment