Commit e39bc9d

mo <mo@mokhan.ca>
2018-09-18 18:33:10
fix some lint errors.
1 parent 73e2a41
Changed files (3)
lib
spec
lib/saml/kit/builders/response.rb
@@ -45,21 +45,13 @@ module Saml
         def assertion
           @assertion ||=
             begin
-              assertion = Saml::Kit::Builders::Assertion.new(
-                user,
-                request,
-                embed_signature,
+              assertion = Assertion.new(user, request, embed_signature,
                 configuration: configuration,
                 now: now,
                 destination: destination,
                 signing_key_pair: signing_key_pair,
-                issuer: issuer
-              )
-              if encrypt
-                Saml::Kit::Builders::EncryptedAssertion.new(self, assertion)
-              else
-                assertion
-              end
+                issuer: issuer)
+              encrypt ? EncryptedAssertion.new(self, assertion) : assertion
             end
         end
 
lib/saml/kit/assertion.rb
@@ -18,7 +18,7 @@ module Saml
       validate :must_match_issuer, if: :decryptable?
       validate :must_be_active_session, if: :decryptable?
       validate :must_have_valid_signature, if: :decryptable?
-      attr_reader :name
+      attr_reader :name, :configuration
       attr_accessor :occurred_at
 
       def initialize(
@@ -76,9 +76,8 @@ module Saml
         at_xpath('../saml:Assertion|../saml:EncryptedAssertion').present?
       end
 
-      def attribute_statement
-        @attribute_statement ||=
-          AttributeStatement.new(search('./saml:AttributeStatement'))
+      def attribute_statement(xpath = './saml:AttributeStatement')
+        @attribute_statement ||= AttributeStatement.new(search(xpath))
       end
 
       def conditions
@@ -100,8 +99,6 @@ module Saml
 
       private
 
-      attr_reader :configuration
-
       def decrypt(decryptor)
         encrypted_assertion = at_xpath('./xmlenc:EncryptedData')
         @encrypted = encrypted_assertion.present?
spec/saml/kit/response_spec.rb
@@ -596,7 +596,7 @@ RSpec.describe Saml::Kit::Response do
     end
   end
 
-  describe ".new" do
+  describe '.new' do
     let(:registry) { instance_double(Saml::Kit::DefaultRegistry) }
     let(:metadata) { instance_double(Saml::Kit::IdentityProviderMetadata) }
     let(:configuration) do