Sha256: 69f81ae243bc5d488083a334b7d0babdedf6ac8d0255e23e9e3b9d17f9c86705

Contents?: true

Size: 1.03 KB

Versions: 31

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe OpenIDConnect::Discovery::Principal do
  describe '.parse' do
    {
      'server.example.com' => OpenIDConnect::Discovery::Principal::URI,
      'http://server.example.com' => OpenIDConnect::Discovery::Principal::URI,
      'nov@server.example.com' => OpenIDConnect::Discovery::Principal::Email,
      '=nov' => OpenIDConnect::Discovery::Principal::XRI,
      '@nov' => OpenIDConnect::Discovery::Principal::XRI
    }.each do |input, klass|
      describe input do
        it do
          OpenIDConnect::Discovery::Principal.parse(input).should be_a klass
        end
      end
    end
  end

  describe '#discover!' do
    let(:request) { OpenIDConnect::Discovery::Principal.new.discover! }

    it 'should do SWD discovery' do
      SWD.should_receive(:discover!)
      request
    end

    context 'when discovery failed' do
      it do
        SWD.should_receive(:discover!).and_raise(SWD::Exception)
        expect { request }.should raise_error OpenIDConnect::Discovery::DiscoveryFailed
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
openid_connect-0.0.24 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.23 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.22 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.21 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.20 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.19 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.18 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.17 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.16 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.15 spec/openid_connect/discovery/principal_spec.rb
openid_connect-0.0.14 spec/openid_connect/discovery/principal_spec.rb