Skip to content

Commit 7be460d

Browse files
Finalizing
1 parent 5eafa99 commit 7be460d

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

spec/omniauth/strategies/saml_spec.rb

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,7 @@ def post_xml(xml = :example_response, opts = {})
412412
end
413413
end
414414

415-
context 'when slo_default_relay_state is present' do
416-
let(:saml_options) { super().merge(slo_default_relay_state: '/signed-out') }
417-
418-
it_behaves_like 'validating RelayState param'
419-
end
415+
it_behaves_like 'validating RelayState param'
420416

421417
context 'when slo_default_relay_state is blank' do
422418
let(:saml_options) { super().merge(slo_default_relay_state: nil) }
@@ -491,6 +487,9 @@ def post_xml(xml = :example_response, opts = {})
491487
end
492488

493489
describe 'POST /auth/saml/spslo' do
490+
let(:params) { {} }
491+
subject { post "/auth/saml/spslo", params }
492+
494493
def test_default_relay_state(static_default_relay_state = nil, &block_default_relay_state)
495494
saml_options["slo_default_relay_state"] = static_default_relay_state || block_default_relay_state
496495
post "/auth/saml/spslo"
@@ -516,43 +515,11 @@ def test_default_relay_state(static_default_relay_state = nil, &block_default_re
516515
end
517516
end
518517

519-
context 'when slo_default_relay_state is present' do
520-
let(:saml_options) { super().merge(slo_default_relay_state: '/signed-out') }
521-
let(:params) { {} }
522-
subject { post "/auth/saml/spslo", params }
523-
524-
it_behaves_like 'validating RelayState param'
525-
526-
context 'when using a custom default relay state' do
527-
let(:saml_options) do
528-
super().merge(
529-
slo_default_relay_state: "custom-state",
530-
slo_relay_state_validator: proc { |state| state == "custom-state" },
531-
)
532-
end
533-
534-
it { is_expected.to be_redirect.and have_attributes(location: a_string_matching(/RelayState=custom-state/)) }
535-
end
536-
537-
context 'with a custom validator expecting the request' do
538-
let(:params) { { RelayState: "/logout" } }
539-
let(:saml_options) do
540-
super().merge(
541-
slo_relay_state_validator: proc do |state, rack_request|
542-
expect(rack_request).to respond_to(:params)
543-
state == rack_request.params["RelayState"]
544-
end,
545-
)
546-
end
547-
548-
it { is_expected.to be_redirect.and have_attributes(location: a_string_matching(/RelayState=%2Flogout/)) }
549-
end
550-
end
518+
it_behaves_like 'validating RelayState param'
551519

552520
context 'when slo_default_relay_state is blank' do
553521
let(:saml_options) { super().merge(slo_default_relay_state: nil) }
554522
let(:params) { { RelayState: "//example.com" } }
555-
subject { post "/auth/saml/spslo", params }
556523

557524
it "redirects without including a RelayState parameter" do
558525
subject

0 commit comments

Comments
 (0)