Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove `fsl` cookie from specs (#13657)

David Taylora1e5a6bbe07f
diff --git a/spec/requests/omniauth_callbacks_controller_spec.rb b/spec/requests/omniauth_callbacks_controller_spec.rb
index bd7421505a9..8f99c8ec33e 100644
--- a/spec/requests/omniauth_callbacks_controller_spec.rb
+++ b/spec/requests/omniauth_callbacks_controller_spec.rb
@@ -600,108 +600,98 @@ RSpec.describe Users::OmniauthCallbacksController do
end
end
- context 'with full screen login' do
- before do
- cookies['fsl'] = true
- end
-
- it "doesn't attempt redirect to external origin" do
- post "/auth/google_oauth2?origin=https://example.com/external"
- get "/auth/google_oauth2/callback"
-
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/"
+ it "doesn't attempt redirect to external origin" do
+ post "/auth/google_oauth2?origin=https://example.com/external"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/"
- it "redirects to internal origin" do
- post "/auth/google_oauth2?origin=http://test.localhost/t/123"
- get "/auth/google_oauth2/callback"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/')
+ end
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/t/123"
+ it "redirects to internal origin" do
+ post "/auth/google_oauth2?origin=http://test.localhost/t/123"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/t/123')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/t/123"
- it "redirects to internal origin on subfolder" do
- set_subfolder "/subpath"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/t/123')
+ end
- post "/auth/google_oauth2?origin=http://test.localhost/subpath/t/123"
- get "/auth/google_oauth2/callback"
+ it "redirects to internal origin on subfolder" do
+ set_subfolder "/subpath"
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/subpath/t/123"
+ post "/auth/google_oauth2?origin=http://test.localhost/subpath/t/123"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/subpath/t/123')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/subpath/t/123"
- it "never redirects to /auth/ origin" do
- post "/auth/google_oauth2?origin=http://test.localhost/auth/google_oauth2"
- get "/auth/google_oauth2/callback"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/subpath/t/123')
+ end
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/"
+ it "never redirects to /auth/ origin" do
+ post "/auth/google_oauth2?origin=http://test.localhost/auth/google_oauth2"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/"
- it "never redirects to /auth/ origin on subfolder" do
- set_subfolder "/subpath"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/')
+ end
- post "/auth/google_oauth2?origin=http://test.localhost/subpath/auth/google_oauth2"
- get "/auth/google_oauth2/callback"
+ it "never redirects to /auth/ origin on subfolder" do
+ set_subfolder "/subpath"
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/subpath"
+ post "/auth/google_oauth2?origin=http://test.localhost/subpath/auth/google_oauth2"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/subpath')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/subpath"
- it "redirects to relative origin" do
- post "/auth/google_oauth2?origin=/t/123"
- get "/auth/google_oauth2/callback"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/subpath')
+ end
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/t/123"
+ it "redirects to relative origin" do
+ post "/auth/google_oauth2?origin=/t/123"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/t/123')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/t/123"
- it "redirects with query" do
- post "/auth/google_oauth2?origin=/t/123?foo=bar"
- get "/auth/google_oauth2/callback"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/t/123')
+ end
- expect(response.status).to eq 302
- expect(response.location).to eq "http://test.localhost/t/123?foo=bar"
+ it "redirects with query" do
+ post "/auth/google_oauth2?origin=/t/123?foo=bar"
+ get "/auth/google_oauth2/callback"
- cookie_data = JSON.parse(response.cookies['authentication_data'])
- expect(cookie_data["destination_url"]).to eq('/t/123?foo=bar')
- end
+ expect(response.status).to eq 302
+ expect(response.location).to eq "http://test.localhost/t/123?foo=bar"
- it "removes authentication_data cookie on logout" do
- post "/auth/google_oauth2?origin=https://example.com/external"
- get "/auth/google_oauth2/callback"
+ cookie_data = JSON.parse(response.cookies['authentication_data'])
+ expect(cookie_data["destination_url"]).to eq('/t/123?foo=bar')
+ end
- provider = log_in_user(Fabricate(:user))
+ it "removes authentication_data cookie on logout" do
+ post "/auth/google_oauth2?origin=https://example.com/external"
+ get "/auth/google_oauth2/callback"
- expect(cookies['authentication_data']).to be
+ provider = log_in_user(Fabricate(:user))
- log_out_user(provider)
+ expect(cookies['authentication_data']).to be
- expect(cookies['authentication_data']).to be_nil
- end
+ log_out_user(provider)
- after do
- cookies.delete('fsl')
- end
+ expect(cookies['authentication_data']).to be_nil
end
end