spec/routes/oauth_spec.rb in osso-0.0.11 vs spec/routes/oauth_spec.rb in osso-0.1.0

- old
+ new

@@ -26,11 +26,11 @@ expect(last_response.status).to eq(200) end end describe 'for a request without email or domain' do - it 'redirects to /auth/saml/:provider_id' do + it 'renders the hosted login page' do get( '/oauth/authorize', client_id: client.identifier, response_type: 'code', redirect_uri: client.redirect_uri_values.sample, @@ -40,11 +40,11 @@ expect(last_response.body).to eq('HOSTED LOGIN') end end describe 'for an enterprise domain with one SAML provider' do - it 'redirects to /auth/saml/:provider_id' do + it 'renders the saml login form' do enterprise = create(:enterprise_with_okta, oauth_client: client) get( '/oauth/authorize', domain: enterprise.domain, @@ -53,13 +53,11 @@ redirect_uri: client.redirect_uri_values.sample, ) provider_id = enterprise.identity_providers.first.id - expect(last_response).to be_redirect - follow_redirect! - expect(last_request.url).to match("auth/saml/#{provider_id}") + expect(last_response.body).to match(provider_id) end end describe 'for an enterprise domain with multiple SAML providers' do it 'renders the multiple providers screen' do @@ -77,11 +75,11 @@ expect(last_response.body).to eq('MULITPLE PROVIDERS') end end describe "for an existing user's email address" do - it 'redirects to /auth/saml/:provider_id' do + it 'renders the saml login form' do enterprise = create(:enterprise_with_okta, oauth_client: client) provider_id = enterprise.identity_providers.first.id user = create(:user, email: "user@#{enterprise.domain}", identity_provider_id: provider_id) get( @@ -90,18 +88,16 @@ client_id: client.identifier, response_type: 'code', redirect_uri: client.redirect_uri_values.sample, ) - expect(last_response).to be_redirect - follow_redirect! - expect(last_request.url).to match("auth/saml/#{provider_id}") + expect(last_response.body).to match(provider_id) end end describe "for a new user's email address belonging to an enterprise with one SAML provider" do - it 'redirects to /auth/saml/:provider_id' do + it 'renders the saml login form' do enterprise = create(:enterprise_with_okta, oauth_client: client) get( '/oauth/authorize', email: "user@#{enterprise.domain}", @@ -110,12 +106,10 @@ redirect_uri: client.redirect_uri_values.sample, ) provider_id = enterprise.identity_providers.first.id - expect(last_response).to be_redirect - follow_redirect! - expect(last_request.url).to match("auth/saml/#{provider_id}") + expect(last_response.body).to match(provider_id) end end describe "for a new user's email address belonging to an enterprise with multiple SAML providers" do it 'renders the multiple providers screen' do