Commit 738e7716
Changed files (2)
app
controllers
spec
controllers
app/controllers/sessions_controller.rb
@@ -9,7 +9,7 @@ class SessionsController < ApplicationController
redirect_to my_dashboard_path
else
flash[:error] = "invalid credentials"
- render :new
+ redirect_to new_session_path
end
end
spec/controllers/sessions_controller_spec.rb
@@ -37,7 +37,7 @@ describe SessionsController do
it "returns an error" do
post :create, session: { username: 'x', password: 'y' }
- expect(response).to render_template(:new)
+ expect(response).to redirect_to(new_session_path)
expect(flash[:error]).to_not be_empty
end
end