demarches-normaliennes/spec/controllers/saml_idp_controller_spec.rb
2021-05-26 18:05:14 +02:00

24 lines
637 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

describe SamlIdpController do
describe '#new' do
let(:action) { get :new }
context 'without superadmin connected' do
it { expect(action).to redirect_to root_path }
it "display alert" do
action
expect(flash[:alert]).to eq("Vous nêtes pas autorisé à accéder à ce service.")
end
end
context 'with superadmin connected' do
let(:superadmin) { create(:super_admin) }
before { sign_in superadmin }
it 'encode saml response' do
expect(subject).to receive(:encode_SAMLResponse).with(superadmin.email, anything())
action
end
end
end
end