debian-mirror-gitlab/spec/initializers/100_patch_omniauth_saml_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
899 B
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2019-09-30 23:59:55 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'OmniAuth::Strategies::SAML', type: :strategy do
2019-09-30 23:59:55 +05:30
let(:idp_sso_target_url) { 'https://login.example.com/idp' }
let(:strategy) { [OmniAuth::Strategies::SAML, { idp_sso_target_url: idp_sso_target_url }] }
describe 'POST /users/auth/saml' do
2021-09-30 23:02:18 +05:30
it 'redirects to the provider login page', :aggregate_failures do
2019-09-30 23:59:55 +05:30
post '/users/auth/saml'
2021-09-30 23:02:18 +05:30
expect(last_response.status).to eq(302)
expect(last_response.location).to match(/\A#{Regexp.quote(idp_sso_target_url)}/)
2019-09-30 23:59:55 +05:30
end
it 'stores request ID during request phase' do
request_id = double
2020-01-01 13:55:28 +05:30
allow_next_instance_of(OneLogin::RubySaml::Authrequest) do |instance|
allow(instance).to receive(:uuid).and_return(request_id)
end
2019-09-30 23:59:55 +05:30
post '/users/auth/saml'
expect(session['last_authn_request_id']).to eq(request_id)
end
end
end