Sha256: c85f08e5d3e2d4742f7d4bbf9e2970ba7aa68c8fb7a49c2a8d20ae6c47d05f7c

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe OmniAuth::Strategies::CAS::Configuration do
  subject { described_class.new }

  let(:options) { Hashie::Mash.new params }

  let(:params) do
    {
      'host' => 'example.org',
      'login_url' => '/'
    }
  end

  describe '#initialize' do
    let(:params) do
      {
        'url'       => 'http://example.org:8080/my_cas',
        'login_url' => '/'
      }
    end

    it 'should initialize the configuration' do
      described_class.any_instance.should_receive(:extract_url)
      described_class.any_instance.should_receive(:validate_cas_setup)

      described_class.new options
    end

    context 'with a URL property' do
      subject { described_class.new( options ).instance_variable_get('@options') }

      it 'should parse the URL' do
        subject.host.should eq 'example.org'
        subject.port.should eq 8080
        subject.path.should eq '/my_cas'
        subject.ssl.should  be_false
      end
    end

    context 'without a URL property' do
      let(:params) do
        {
          'host'      => 'example.org',
          'login_url' => '/'
        }
      end

      subject { described_class.new( options ) }

      it 'should not parse the url' do
        described_class.any_instance
          .should_receive(:extract_url)
          .never

        described_class.new options
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
omniauth-cas-1.0.4 spec/omniauth/strategies/cas/configuration_spec.rb
omniauth-cas-1.0.3 spec/omniauth/strategies/cas/configuration_spec.rb
omniauth-cas-1.1.0.beta.1 spec/omniauth/strategies/cas/configuration_spec.rb
omniauth-cas-1.0.2 spec/omniauth/strategies/cas/configuration_spec.rb