Commit d3d53c9

mo <mo.khan@gmail.com>
2018-02-17 00:57:37
fix cop violations.
1 parent 0e1afd6
spec/saml/kit/builders/identity_provider_metadata_spec.rb
@@ -33,10 +33,10 @@ RSpec.describe Saml::Kit::Builders::IdentityProviderMetadata do
     expect(result['EntityDescriptor']['IDPSSODescriptor']['protocolSupportEnumeration']).to eql(Saml::Kit::Namespaces::PROTOCOL)
     expect(result['EntityDescriptor']['IDPSSODescriptor']['WantAuthnRequestsSigned']).to eql('true')
     expect(result['EntityDescriptor']['IDPSSODescriptor']['NameIDFormat']).to match_array([
-                                                                                            Saml::Kit::Namespaces::PERSISTENT,
-                                                                                            Saml::Kit::Namespaces::TRANSIENT,
-                                                                                            Saml::Kit::Namespaces::EMAIL_ADDRESS,
-                                                                                          ])
+      Saml::Kit::Namespaces::PERSISTENT,
+      Saml::Kit::Namespaces::TRANSIENT,
+      Saml::Kit::Namespaces::EMAIL_ADDRESS,
+    ])
     expect(result['EntityDescriptor']['IDPSSODescriptor']['SingleSignOnService']['Binding']).to eql(Saml::Kit::Bindings::HTTP_REDIRECT)
     expect(result['EntityDescriptor']['IDPSSODescriptor']['SingleSignOnService']['Location']).to eql('https://www.example.com/login')
     expect(result['EntityDescriptor']['IDPSSODescriptor']['SingleLogoutService']['Binding']).to eql(Saml::Kit::Bindings::HTTP_POST)
spec/saml/kit/builders/service_provider_metadata_spec.rb
@@ -33,10 +33,10 @@ RSpec.describe Saml::Kit::Builders::ServiceProviderMetadata do
     expect(result['EntityDescriptor']['SPSSODescriptor']['WantAssertionsSigned']).to eql('true')
     expect(result['EntityDescriptor']['SPSSODescriptor']['protocolSupportEnumeration']).to eql('urn:oasis:names:tc:SAML:2.0:protocol')
     expect(result['EntityDescriptor']['SPSSODescriptor']['NameIDFormat']).to match_array([
-                                                                                           Saml::Kit::Namespaces::PERSISTENT,
-                                                                                           Saml::Kit::Namespaces::TRANSIENT,
-                                                                                           Saml::Kit::Namespaces::EMAIL_ADDRESS,
-                                                                                         ])
+      Saml::Kit::Namespaces::PERSISTENT,
+      Saml::Kit::Namespaces::TRANSIENT,
+      Saml::Kit::Namespaces::EMAIL_ADDRESS,
+    ])
     expect(result['EntityDescriptor']['SPSSODescriptor']['AssertionConsumerService']['Binding']).to eql('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST')
     expect(result['EntityDescriptor']['SPSSODescriptor']['AssertionConsumerService']['Location']).to eql(assertion_consumer_service_url)
     expect(result['EntityDescriptor']['SPSSODescriptor']['AssertionConsumerService']['isDefault']).to eql('true')
spec/saml/kit/assertion_spec.rb
@@ -114,7 +114,7 @@ XML
 
   describe '#signed?' do
     let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: ::Xml::Kit::Id.generate, issuer: FFaker::Internet.http_url, assertion_consumer_service_url: FFaker::Internet.http_url, name_id_format: Saml::Kit::Namespaces::PERSISTENT, provider: nil, signed?: true, trusted?: true) }
-    let(:user) { double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: { id: SecureRandom.uuid }) }
+    let(:user) { User.new(attributes: { id: SecureRandom.uuid }) }
 
     it 'detects a signature in an encrypted assertion' do
       encryption_key_pair = Xml::Kit::KeyPair.generate(use: :encryption)
@@ -130,7 +130,7 @@ XML
 
   describe '#to_xml' do
     let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: ::Xml::Kit::Id.generate, issuer: FFaker::Internet.http_url, assertion_consumer_service_url: FFaker::Internet.http_url, name_id_format: Saml::Kit::Namespaces::PERSISTENT, provider: nil, signed?: true, trusted?: true) }
-    let(:user) { double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: { id: SecureRandom.uuid }) }
+    let(:user) { User.new(attributes: { id: SecureRandom.uuid }) }
 
     it 'returns the decrypted xml' do
       encryption_key_pair = Xml::Kit::KeyPair.generate(use: :encryption)
@@ -148,8 +148,8 @@ XML
     let(:entity_id) { FFaker::Internet.uri('https') }
     let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: ::Xml::Kit::Id.generate, issuer: entity_id, assertion_consumer_service_url: FFaker::Internet.http_url, name_id_format: Saml::Kit::Namespaces::PERSISTENT, provider: nil, signed?: true, trusted?: true) }
     let(:name_id) { SecureRandom.uuid }
-    let(:user) { double(:user, name_id_for: name_id, assertion_attributes_for: { id: SecureRandom.uuid }) }
-    let(:registry) { double(:registry, metadata_for: idp) }
+    let(:user) { User.new(name_id: name_id, attributes: { id: SecureRandom.uuid }) }
+    let(:registry) { instance_double(Saml::Kit::DefaultRegistry, metadata_for: idp) }
     let(:idp) { Saml::Kit::IdentityProviderMetadata.build(configuration: configuration) }
     let(:configuration) do
       Saml::Kit::Configuration.new do |x|
spec/saml/kit/authentication_request_spec.rb
@@ -200,7 +200,7 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
   end
 
   describe '#response_for' do
-    let(:user) { double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: []) }
+    let(:user) { User.new }
     let(:provider) do
       Saml::Kit::ServiceProviderMetadata.build do |x|
         x.add_assertion_consumer_service(FFaker::Internet.uri('https'), binding: :http_post)
@@ -209,7 +209,7 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
 
     it 'serializes a response' do
       allow(subject).to receive(:provider).and_return(provider)
-      url, saml_params = subject.response_for(user, binding: :http_post, relay_state: FFaker::Movie.title)
+      _url, saml_params = subject.response_for(user, binding: :http_post, relay_state: FFaker::Movie.title)
 
       response = provider.assertion_consumer_service_for(binding: :http_post).deserialize(saml_params)
       expect(response).to be_instance_of(Saml::Kit::Response)
@@ -221,7 +221,7 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
         config.generate_key_pair_for(use: :signing)
       end
       key_pair = configuration.key_pairs(use: :signing).first
-      url, saml_params = subject.response_for(user, binding: :http_post, configuration: configuration) do |builder|
+      _url, saml_params = subject.response_for(user, binding: :http_post, configuration: configuration) do |builder|
         builder.sign_with(key_pair)
       end
 
spec/saml/kit/composite_metadata_spec.rb
@@ -70,9 +70,9 @@ RSpec.describe Saml::Kit::CompositeMetadata do
   describe '#single_sign_on_services' do
     it 'returns the single sign on services from the idp' do
       expect(subject.single_sign_on_services).to match_array([
-                                                               Saml::Kit::Bindings::HttpPost.new(location: sign_on_service),
-                                                               Saml::Kit::Bindings::HttpRedirect.new(location: sign_on_service),
-                                                             ])
+        Saml::Kit::Bindings::HttpPost.new(location: sign_on_service),
+        Saml::Kit::Bindings::HttpRedirect.new(location: sign_on_service),
+      ])
     end
   end
 
@@ -89,8 +89,8 @@ RSpec.describe Saml::Kit::CompositeMetadata do
   it { expect(subject.login_request_for(binding: :http_post)).to be_present }
   it do
     expect(subject.assertion_consumer_services).to match_array([
-                                                                 Saml::Kit::Bindings::HttpPost.new(location: assertion_consumer_service)
-                                                               ])
+      Saml::Kit::Bindings::HttpPost.new(location: assertion_consumer_service)
+    ])
   end
   it do
     expect(subject.assertion_consumer_service_for(binding: :http_post)).to eql(
@@ -102,30 +102,30 @@ RSpec.describe Saml::Kit::CompositeMetadata do
   it { expect(subject.name_id_formats).to match_array([Saml::Kit::Namespaces::PERSISTENT]) }
   it do
     expect(subject.certificates).to match_array([
-                                                  sp_signing_certificate,
-                                                  sp_encryption_certificate,
-                                                  idp_signing_certificate,
-                                                  idp_encryption_certificate,
-                                                ])
+      sp_signing_certificate,
+      sp_encryption_certificate,
+      idp_signing_certificate,
+      idp_encryption_certificate,
+    ])
   end
 
   it do
     expect(subject.encryption_certificates).to match_array([
-                                                             sp_encryption_certificate,
-                                                             idp_encryption_certificate,
-                                                           ])
+      sp_encryption_certificate,
+      idp_encryption_certificate,
+    ])
   end
   it do
     expect(subject.signing_certificates).to match_array([
-                                                          sp_signing_certificate,
-                                                          idp_signing_certificate,
-                                                        ])
+      sp_signing_certificate,
+      idp_signing_certificate,
+    ])
   end
   it do
     expect(subject.services('SingleLogoutService')).to match_array([
-                                                                     Saml::Kit::Bindings::HttpPost.new(location: sp_logout_service),
-                                                                     Saml::Kit::Bindings::HttpPost.new(location: idp_logout_service),
-                                                                   ])
+      Saml::Kit::Bindings::HttpPost.new(location: sp_logout_service),
+      Saml::Kit::Bindings::HttpPost.new(location: idp_logout_service),
+    ])
   end
   it do
     expect(subject.service_for(type: 'SingleLogoutService', binding: :http_post)).to eql(
@@ -134,8 +134,8 @@ RSpec.describe Saml::Kit::CompositeMetadata do
   end
   it do
     expect(subject.services('AssertionConsumerService')).to match_array([
-                                                                          Saml::Kit::Bindings::HttpPost.new(location: assertion_consumer_service),
-                                                                        ])
+      Saml::Kit::Bindings::HttpPost.new(location: assertion_consumer_service),
+    ])
   end
   it do
     expect(subject.service_for(type: 'AssertionConsumerService', binding: :http_post)).to eql(
@@ -144,9 +144,9 @@ RSpec.describe Saml::Kit::CompositeMetadata do
   end
   it do
     expect(subject.services('SingleSignOnService')).to match_array([
-                                                                     Saml::Kit::Bindings::HttpPost.new(location: sign_on_service),
-                                                                     Saml::Kit::Bindings::HttpRedirect.new(location: sign_on_service),
-                                                                   ])
+      Saml::Kit::Bindings::HttpPost.new(location: sign_on_service),
+      Saml::Kit::Bindings::HttpRedirect.new(location: sign_on_service),
+    ])
   end
   it do
     expect(subject.service_for(type: 'SingleSignOnService', binding: :http_post)).to eql(
@@ -156,9 +156,9 @@ RSpec.describe Saml::Kit::CompositeMetadata do
 
   it do
     expect(subject.single_logout_services).to match_array([
-                                                            Saml::Kit::Bindings::HttpPost.new(location: sp_logout_service),
-                                                            Saml::Kit::Bindings::HttpPost.new(location: idp_logout_service),
-                                                          ])
+      Saml::Kit::Bindings::HttpPost.new(location: sp_logout_service),
+      Saml::Kit::Bindings::HttpPost.new(location: idp_logout_service),
+    ])
   end
 
   it do
@@ -167,8 +167,5 @@ RSpec.describe Saml::Kit::CompositeMetadata do
     )
   end
 
-  it do
-    user = double(:user, name_id_for: SecureRandom.uuid)
-    expect(subject.logout_request_for(user)).to be_present
-  end
+  specify { expect(subject.logout_request_for(User.new)).to be_present }
 end
spec/saml/kit/document_spec.rb
@@ -2,7 +2,7 @@ RSpec.describe Saml::Kit::Document do
   describe '.to_saml_document' do
     subject { described_class }
 
-    let(:user) { double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: { id: SecureRandom.uuid }) }
+    let(:user) { User.new(attributes: { id: SecureRandom.uuid }) }
     let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: Xml::Kit::Id.generate, issuer: FFaker::Internet.http_url, assertion_consumer_service_url: FFaker::Internet.http_url, name_id_format: Saml::Kit::Namespaces::PERSISTENT, provider: nil, signed?: true, trusted?: true) }
 
     it 'returns a Response' do
spec/saml/kit/identity_provider_metadata_spec.rb
@@ -1,7 +1,7 @@
 RSpec.describe Saml::Kit::IdentityProviderMetadata do
   subject { described_class.new(raw_metadata) }
 
-  context 'okta metadata' do
+  describe 'okta metadata' do
     let(:raw_metadata) { IO.read('spec/fixtures/metadata/okta.xml') }
     let(:certificate) do
       Hash.from_xml(raw_metadata)['EntityDescriptor']['IDPSSODescriptor']['KeyDescriptor']['KeyInfo']['X509Data']['X509Certificate']
@@ -12,9 +12,9 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
     it do
       location = 'https://dev.oktapreview.com/app/example/1/sso/saml'
       expect(subject.single_sign_on_services.map(&:to_h)).to match_array([
-                                                                           { binding: Saml::Kit::Bindings::HTTP_POST, location: location },
-                                                                           { binding: Saml::Kit::Bindings::HTTP_REDIRECT, location: location },
-                                                                         ])
+        { binding: Saml::Kit::Bindings::HTTP_POST, location: location },
+        { binding: Saml::Kit::Bindings::HTTP_REDIRECT, location: location },
+      ])
     end
     it { expect(subject.single_logout_services).to be_empty }
     it do
@@ -25,7 +25,7 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
     it { expect(subject.attributes).to be_empty }
   end
 
-  context 'active directory' do
+  describe 'active directory' do
     let(:raw_metadata) { IO.read('spec/fixtures/metadata/ad_2012.xml') }
     let(:xml_hash) { Hash.from_xml(raw_metadata) }
     let(:signing_certificate) do
@@ -38,30 +38,30 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
     it { expect(subject.entity_id).to eql('http://www.example.com/adfs/services/trust') }
     it do
       expect(subject.name_id_formats).to match_array([
-                                                       Saml::Kit::Namespaces::EMAIL_ADDRESS,
-                                                       Saml::Kit::Namespaces::PERSISTENT,
-                                                       Saml::Kit::Namespaces::TRANSIENT,
-                                                     ])
+        Saml::Kit::Namespaces::EMAIL_ADDRESS,
+        Saml::Kit::Namespaces::PERSISTENT,
+        Saml::Kit::Namespaces::TRANSIENT,
+      ])
     end
     it do
       location = 'https://www.example.com/adfs/ls/'
       expect(subject.single_sign_on_services.map(&:to_h)).to match_array([
-                                                                           { location: location, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
-                                                                           { location: location, binding: Saml::Kit::Bindings::HTTP_POST },
-                                                                         ])
+        { location: location, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
+        { location: location, binding: Saml::Kit::Bindings::HTTP_POST },
+      ])
     end
     it do
       location = 'https://www.example.com/adfs/ls/'
       expect(subject.single_logout_services.map(&:to_h)).to match_array([
-                                                                          { location: location, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
-                                                                          { location: location, binding: Saml::Kit::Bindings::HTTP_POST },
-                                                                        ])
+        { location: location, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
+        { location: location, binding: Saml::Kit::Bindings::HTTP_POST },
+      ])
     end
     it do
       expect(subject.certificates).to match_array([
-                                                    ::Xml::Kit::Certificate.new(signing_certificate, use: :signing),
-                                                    ::Xml::Kit::Certificate.new(encryption_certificate, use: :encryption),
-                                                  ])
+        ::Xml::Kit::Certificate.new(signing_certificate, use: :signing),
+        ::Xml::Kit::Certificate.new(encryption_certificate, use: :encryption),
+      ])
     end
     it { expect(subject.attributes).to be_present }
   end
@@ -210,7 +210,7 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
       subject = described_class.build do |x|
         x.add_single_sign_on_service(FFaker::Internet.uri('https'), binding: :http_post)
       end
-      url, saml_params = subject.login_request_for(binding: :http_post, relay_state: FFaker::Movie.title)
+      _url, saml_params = subject.login_request_for(binding: :http_post, relay_state: FFaker::Movie.title)
       result = subject.single_sign_on_service_for(binding: :http_post).deserialize(saml_params)
       expect(result).to be_instance_of(Saml::Kit::AuthenticationRequest)
     end
spec/saml/kit/logout_request_spec.rb
@@ -1,7 +1,7 @@
 RSpec.describe Saml::Kit::LogoutRequest do
   subject { described_class.build(user, configuration: configuration) }
 
-  let(:user) { double(:user, name_id_for: name_id) }
+  let(:user) { User.new(name_id: name_id) }
   let(:name_id) { SecureRandom.uuid }
   let(:entity_id) { FFaker::Internet.uri('https') }
   let(:registry) { instance_double(Saml::Kit::DefaultRegistry) }
@@ -103,8 +103,8 @@ RSpec.describe Saml::Kit::LogoutRequest do
       allow(registry).to receive(:metadata_for).with(issuer).and_return(metadata)
       allow(metadata).to receive(:matches?).and_return(true)
       allow(metadata).to receive(:single_logout_services).and_return([
-                                                                       Saml::Kit::Bindings::HttpPost.new(location: FFaker::Internet.uri('https'))
-                                                                     ])
+        Saml::Kit::Bindings::HttpPost.new(location: FFaker::Internet.uri('https'))
+      ])
 
       subject = described_class.build(user, configuration: configuration) do |builder|
         builder.issuer = issuer
spec/saml/kit/logout_response_spec.rb
@@ -1,2 +1,5 @@
 RSpec.describe Saml::Kit::LogoutResponse do
+  it 'exists' do
+    expect(described_class).to be(described_class)
+  end
 end
spec/saml/kit/response_spec.rb
@@ -3,7 +3,7 @@ RSpec.describe Saml::Kit::Response do
     subject { described_class.build(user, request, configuration: configuration) }
 
     let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: ::Xml::Kit::Id.generate, issuer: FFaker::Internet.http_url, assertion_consumer_service_url: FFaker::Internet.http_url, name_id_format: Saml::Kit::Namespaces::PERSISTENT, provider: nil, signed?: true, trusted?: true) }
-    let(:user) { double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: { id: SecureRandom.uuid }) }
+    let(:user) { User.new(attributes: { id: SecureRandom.uuid }) }
     let(:registry) { instance_double(Saml::Kit::DefaultRegistry) }
     let(:metadata) { instance_double(Saml::Kit::IdentityProviderMetadata) }
 
@@ -127,7 +127,7 @@ RSpec.describe Saml::Kit::Response do
       allow(metadata).to receive(:matches?).and_return(true)
 
       subject = described_class.build(user, request)
-      travel_to (Saml::Kit.configuration.clock_drift + 1.second).before(Time.now)
+      travel_to((Saml::Kit.configuration.clock_drift + 1.second).before(Time.now))
       expect(subject).to be_invalid
       expect(subject.errors[:assertion]).to match_array(['must not be expired.'])
     end
@@ -179,7 +179,7 @@ RSpec.describe Saml::Kit::Response do
         Version: '2.0',
         xmlns: Saml::Kit::Namespaces::ASSERTION,
       }
-      xml = ::Xml::Kit::Signatures.sign(key_pair: key_pair) do |xml, signature|
+      raw_xml = ::Xml::Kit::Signatures.sign(key_pair: key_pair) do |xml, signature|
         xml.instruct!
         xml.Response response_options do
           xml.Issuer(issuer, xmlns: Saml::Kit::Namespaces::ASSERTION)
@@ -228,13 +228,13 @@ RSpec.describe Saml::Kit::Response do
           end
         end
       end
-      subject = described_class.new(xml)
+      subject = described_class.new(raw_xml)
       expect(subject).not_to be_valid
       expect(subject.errors.full_messages).to include('must contain a single Assertion.')
     end
 
     it 'is invalid when the assertion has a signature and has been tampered with' do
-      user = double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: { token: SecureRandom.uuid })
+      user = User.new(attributes: { token: SecureRandom.uuid })
       request = Saml::Kit::AuthenticationRequest.build
       document = described_class.build(user, request, configuration: configuration) do |x|
         x.embed_signature = false
@@ -433,7 +433,7 @@ RSpec.describe Saml::Kit::Response do
     let(:assertion_consumer_service_url) { FFaker::Internet.uri('https') }
     let(:password) { FFaker::Movie.title }
     let(:email) { FFaker::Internet.email }
-    let(:created_at) { DateTime.now }
+    let(:created_at) { Time.now }
     let(:assertion) do
       <<-XML.strip_heredoc
         <Assertion xmlns="#{Saml::Kit::Namespaces::ASSERTION}" ID="#{id}" IssueInstant="2017-11-23T04:33:58Z" Version="2.0">
@@ -506,20 +506,20 @@ XML
 
       subject = described_class.new(xml)
       expect(subject.attributes).to match_array([
-                                                  ['created_at', created_at.iso8601],
-                                                  ['email', email]
-                                                ])
+        ['created_at', created_at.iso8601],
+        ['email', email]
+      ])
     end
   end
 
   describe 'parsing' do
-    let(:user) { double(:user, name_id_for: SecureRandom.uuid, assertion_attributes_for: attributes) }
-    let(:request) { double(:request, id: Xml::Kit::Id.generate, signed?: true, trusted?: true, provider: nil, assertion_consumer_service_url: FFaker::Internet.uri('https'), name_id_format: '', issuer: FFaker::Internet.uri('https')) }
+    let(:user) { User.new(attributes: attributes) }
+    let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: Xml::Kit::Id.generate, signed?: true, trusted?: true, provider: nil, assertion_consumer_service_url: FFaker::Internet.uri('https'), name_id_format: '', issuer: FFaker::Internet.uri('https')) }
     let(:attributes) { { name: 'mo' } }
 
     it 'returns the name id' do
       subject = described_class.build(user, request)
-      expect(subject.name_id).to eql(user.name_id_for)
+      expect(subject.name_id).to eql(user.name_id)
     end
 
     it 'returns the single attributes' do
spec/saml/kit/service_provider_metadata_spec.rb
@@ -25,22 +25,22 @@ RSpec.describe Saml::Kit::ServiceProviderMetadata do
 
     it 'returns each acs url and binding' do
       expect(subject.assertion_consumer_services.map(&:to_h)).to match_array([
-                                                                               { location: acs_post_url, binding: Saml::Kit::Bindings::HTTP_POST },
-                                                                               { location: acs_redirect_url, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
-                                                                             ])
+        { location: acs_post_url, binding: Saml::Kit::Bindings::HTTP_POST },
+        { location: acs_redirect_url, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
+      ])
     end
 
     it 'returns each logout url and binding' do
       expect(subject.single_logout_services.map(&:to_h)).to match_array([
-                                                                          { location: logout_post_url, binding: Saml::Kit::Bindings::HTTP_POST },
-                                                                          { location: logout_redirect_url, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
-                                                                        ])
+        { location: logout_post_url, binding: Saml::Kit::Bindings::HTTP_POST },
+        { location: logout_redirect_url, binding: Saml::Kit::Bindings::HTTP_REDIRECT },
+      ])
     end
 
     it 'returns each of the nameid formats' do
       expect(subject.name_id_formats).to match_array([
-                                                       Saml::Kit::Namespaces::PERSISTENT
-                                                     ])
+        Saml::Kit::Namespaces::PERSISTENT
+      ])
     end
 
     it 'returns the entity id' do
spec/saml/kit/signature_spec.rb
@@ -56,8 +56,8 @@ RSpec.describe Saml::Kit::Signature do
         it 'is invalid' do
           expect(subject).to be_invalid
           expect(subject.errors[:certificate]).to match_array([
-                                                                "Not valid before #{expired_certificate.not_before}. Not valid after #{expired_certificate.not_after}."
-                                                              ])
+            "Not valid before #{expired_certificate.not_before}. Not valid after #{expired_certificate.not_after}."
+          ])
         end
       end
 
@@ -68,8 +68,8 @@ RSpec.describe Saml::Kit::Signature do
         it 'invalid' do
           expect(subject).to be_invalid
           expect(subject.errors[:certificate]).to match_array([
-                                                                "Not valid before #{expired_certificate.not_before}. Not valid after #{expired_certificate.not_after}."
-                                                              ])
+            "Not valid before #{expired_certificate.not_before}. Not valid after #{expired_certificate.not_after}."
+          ])
         end
       end
     end
spec/support/user.rb
@@ -0,0 +1,16 @@
+class User
+  attr_reader :name_id, :attributes
+
+  def initialize(name_id: SecureRandom.uuid, attributes: {})
+    @name_id = name_id
+    @attributes = attributes
+  end
+
+  def name_id_for(_format)
+    name_id
+  end
+
+  def assertion_attributes_for(_request)
+    attributes
+  end
+end
.rubocop.yml
@@ -31,6 +31,9 @@ Layout/ClassStructure:
 Layout/EndOfLine:
   EnforcedStyle: lf
 
+Layout/IndentArray:
+  EnforcedStyle: consistent
+
 Layout/IndentHeredoc:
   EnforcedStyle: active_support
 
@@ -63,10 +66,10 @@ Style/TrailingCommaInLiteral:
   Enabled: false
 
 RSpec/ExampleLength:
-  Max: 10
+  Max: 80
 
 RSpec/MultipleExpectations:
-  Max: 5
+  Enabled: false
 
 RSpec/NamedSubject:
   Enabled: false