main
 1# frozen_string_literal: true
 2
 3RSpec.describe Saml::Kit::Bindings do
 4  describe '.to_symbol' do
 5    subject { described_class }
 6
 7    it { expect(subject.to_symbol(Saml::Kit::Bindings::HTTP_POST)).to be(:http_post) }
 8    it { expect(subject.to_symbol(Saml::Kit::Bindings::HTTP_REDIRECT)).to be(:http_redirect) }
 9    it { expect(subject.to_symbol('unknown')).to eql('unknown') }
10  end
11
12  describe '.create_for' do
13    subject { described_class }
14
15    let(:location) { FFaker::Internet.uri('https') }
16
17    it 'returns an HTTP redirect binding' do
18      expect(
19        subject.create_for(Saml::Kit::Bindings::HTTP_REDIRECT, location)
20      ).to be_instance_of(Saml::Kit::Bindings::HttpRedirect)
21    end
22
23    it 'returns an HTTP Post binding' do
24      expect(
25        subject.create_for(Saml::Kit::Bindings::HTTP_POST, location)
26      ).to be_instance_of(Saml::Kit::Bindings::HttpPost)
27    end
28
29    it 'returns an unknown binding' do
30      expect(
31        subject.create_for(Saml::Kit::Bindings::HTTP_ARTIFACT, location)
32      ).to be_instance_of(Saml::Kit::Bindings::Binding)
33    end
34  end
35end