Commit 3483e13

mo <mo@mokhan.ca>
2017-11-18 03:02:56
update failing spec to find destination.
1 parent b266206
Changed files (1)
spec/saml/logout_response_spec.rb
@@ -7,9 +7,17 @@ RSpec.describe Saml::Kit::LogoutResponse do
     let(:user) { double(:user, name_id_for: SecureRandom.uuid) }
     let(:request) { Saml::Kit::LogoutRequest::Builder.new(user).build }
     let(:issuer) { FFaker::Internet.http_url }
+    let(:destination) { FFaker::Internet.http_url }
+    let(:registry) { double(:registry) }
+    let(:provider) { double(:provider) }
+    let(:binding) { double(:binding, location: destination) }
 
     describe "#build" do
       it 'builds a logout response' do
+        allow(configuration).to receive(:registery).and_return(registry)
+        allow(registry).to receive(:metadata_for).with(issuer).and_return(provider)
+        allow(registry).to receive(:single_logout_service_for).and_return(binding)
+
         travel_to 1.second.from_now
 
         result = subject.build
@@ -19,7 +27,7 @@ RSpec.describe Saml::Kit::LogoutResponse do
         expect(result.issuer).to eql(issuer)
         expect(result.status_code).to eql(Saml::Kit::Namespaces::SUCCESS)
         expect(result.in_response_to).to eql(request.id)
-        expect(result.destination).to be_present
+        expect(result.destination).to eql(destination)
       end
     end
   end