spec/omniauth/strategies/shibboleth_spec.rb in omniauth-shibboleth-1.0.5 vs spec/omniauth/strategies/shibboleth_spec.rb in omniauth-shibboleth-1.0.6
- old
+ new
@@ -7,10 +7,18 @@
'rack.session' => {},
'rack.input' => StringIO.new('test=true')
}.merge(props)
end
+def failure_path
+ if OmniAuth::VERSION >= "1.0" && OmniAuth::VERSION < "1.1"
+ "/auth/failure?message=no_shibboleth_session"
+ elsif OmniAuth::VERSION >= "1.1"
+ "/auth/failure?message=no_shibboleth_session&strategy=shibboleth"
+ end
+end
+
describe OmniAuth::Strategies::Shibboleth do
let(:app){ Rack::Builder.new do |b|
b.use Rack::Session::Cookie
b.use OmniAuth::Strategies::Shibboleth
b.run lambda{|env| [200, {}, ['Not Found']]}
@@ -33,11 +41,11 @@
get '/auth/shibboleth/callback'
end
it 'should fail to get Shib-Session-ID environment variable' do
last_response.status.should == 302
- last_response.location.should == '/auth/failure?message=no_shibboleth_session'
+ last_response.location.should == failure_path
end
end
context 'with Shibboleth session' do
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, {}) }
@@ -68,11 +76,11 @@
strategy.env['omniauth.auth']['extra']['raw_info']['o'].should == @organization
strategy.env['omniauth.auth']['extra']['raw_info']['affiliation'].should == @affiliation
end
end
- context 'with dev_mode options' do
- let(:options){ { :dev_mode => true} }
+ context 'with debug options' do
+ let(:options){ { :debug => true} }
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
it 'should raise environment variables' do
@dummy_id = 'abcdefg'
@eppn = 'test@example.com'