Skip to content

Commit

Permalink
Fixes some test issues with #26
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Lindahl committed Nov 20, 2013
1 parent b023737 commit 37d5c49
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 61 deletions.
1 change: 0 additions & 1 deletion lib/omniauth/strategies/cas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class CAS
class MissingCASTicket < StandardError; end
class InvalidCASTicket < StandardError; end

autoload :Configuration, 'omniauth/strategies/cas/configuration'
autoload :ServiceTicketValidator, 'omniauth/strategies/cas/service_ticket_validator'
autoload :LogoutRequest, 'omniauth/strategies/cas/logout_request'

Expand Down
60 changes: 0 additions & 60 deletions spec/omniauth/strategies/cas/configuration_spec.rb

This file was deleted.

44 changes: 44 additions & 0 deletions spec/omniauth/strategies/cas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,50 @@ def app
end
end

describe '#cas_url' do
let(:params) { Hash.new }

let(:provider) { MyCasProvider.new(nil, params) }

subject { provider.cas_url }

it 'raises an ArgumentError' do
expect{subject}.to raise_error ArgumentError, %r{:host and :login_url MUST be provided}
end

context 'with an explicit :url option' do
let(:url) { 'https://example.org:8080/my_cas' }

let(:params) { super().merge url:url }

before { subject }

it { should eq url }

it 'parses the URL into it the appropriate strategy options' do
expect(provider.options).to include ssl:true
expect(provider.options).to include host:'example.org'
expect(provider.options).to include port:8080
expect(provider.options).to include path:'/my_cas'
end
end

context 'with explicit URL component' do
let(:params) { super().merge host:'example.org', port:1234, ssl:true, path:'/a/path' }

before { subject }

it { should eq 'https://example.org:1234/a/path' }

it 'parses the URL into it the appropriate strategy options' do
expect(provider.options).to include ssl:true
expect(provider.options).to include host:'example.org'
expect(provider.options).to include port:1234
expect(provider.options).to include path:'/a/path'
end
end
end

describe 'defaults' do
subject { MyCasProvider.default_options.to_hash }
it { should include('ssl' => true) }
Expand Down

0 comments on commit 37d5c49

Please sign in to comment.