Skip to content

Commit

Permalink
add request specs
Browse files Browse the repository at this point in the history
  • Loading branch information
stepchud committed Jul 24, 2024
1 parent d4426f8 commit 176c324
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/requests/sessions_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,18 @@
expect(response).to redirect_to("/session/new")
expect(flash[:error]).to include("Please try again.")
end

it "get /auth/result with error param redirects to login" do
get "/auth/result", params: { error: "there was an error" }
expect(response).to redirect_to("/session/new")
expect(flash[:error]).to include("Please try again.")
end

it "get /auth/result successful" do
code = "ABC123"
login_gov = instance_double(LoginGov)
allow(LoginGov).to receive(:new).and_return(login_gov)
allow(login_gov).to receive(:exchange_token_from_auth_result).with(code).and_return({ email: "[email protected]" })
get "/auth/result", params: { code: }
end
end

0 comments on commit 176c324

Please sign in to comment.