spec/routes/auth_spec.rb in osso-0.0.3.15 vs spec/routes/auth_spec.rb in osso-0.0.3.16

- old
+ new

@@ -61,9 +61,27 @@ 'identity_provider' => okta_provider, }, ) end.to change { Osso::Models::AuthorizationCode.count }.by(1) end + + describe 'for an IDP initiated login' do + it 'redirects with a default state' do + mock_saml_omniauth + + post( + "/auth/saml/#{okta_provider.id}/callback", + nil, + { + 'omniauth.auth' => OmniAuth.config.mock_auth[:saml], + 'identity_provider' => okta_provider, + }, + ) + expect(last_response).to be_redirect + follow_redirect! + expect(last_request.url).to match(/.*state=IDP_INITIATED$/) + end + end end describe 'on subsequent authentications' do let!(:enterprise) { create(:enterprise_with_okta) } let!(:okta_provider) { enterprise.identity_providers.first }