Commit 6a28e40

mo <mo@mokhan.ca>
2017-12-15 05:15:06
add build_xml method.
1 parent c5a3b3c
Changed files (2)
lib/saml/kit/buildable.rb
@@ -8,6 +8,10 @@ module Saml
           builder(*args, &block).build
         end
 
+        def build_xml(*args, &block)
+          builder(*args, &block).to_xml
+        end
+
         def builder(*args)
           builder_class.new(*args).tap do |builder|
             yield builder if block_given?
spec/saml/authentication_request_spec.rb
@@ -8,14 +8,14 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
   let(:destination) { FFaker::Internet.http_url }
   let(:name_id_format) { Saml::Kit::Namespaces::EMAIL_ADDRESS }
   let(:raw_xml) do
-    described_class.build(configuration: configuration) do |builder|
+    described_class.build_xml(configuration: configuration) do |builder|
       builder.id = id
       builder.now = Time.now.utc
       builder.issuer = issuer
       builder.assertion_consumer_service_url = assertion_consumer_service_url
       builder.name_id_format = name_id_format
       builder.destination = destination
-    end.to_xml
+    end
   end
   let(:configuration) do
     Saml::Kit::Configuration.new do |config|
@@ -36,7 +36,6 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
     before :each do
       allow(configuration).to receive(:registry).and_return(registry)
       allow(registry).to receive(:metadata_for).and_return(metadata)
-      #allow(metadata).to receive(:matches?).and_return(true)
     end
 
     it 'is valid when left untampered' do