Commit 3fd6a59

mo <mo@mokhan.ca>
2018-12-04 19:22:47
fix linter errors.
1 parent 3496a83
Changed files (4)
lib/saml/kit/attribute_statement.rb
@@ -16,11 +16,7 @@ module Saml
         @attributes ||= search('./saml:Attribute').inject({}) do |memo, item|
           namespace = Saml::Kit::Document::NAMESPACES
           values = item.search('./saml:AttributeValue', namespace)
-          if values.length == 1
-            memo[item.attribute('Name').value] = values[0].try(:text)
-          else
-            memo[item.attribute('Name').value] = values.map { |x| x.try(:text) }
-          end
+          memo[item.attribute('Name').value] = values.length == 1 ? values[0].try(:text) : values.map { |x| x.try(:text) }
           memo
         end.with_indifferent_access
       end
lib/saml/kit/version.rb
@@ -2,6 +2,6 @@
 
 module Saml
   module Kit
-    VERSION = '1.0.27'.freeze
+    VERSION = '1.0.28'.freeze
   end
 end
spec/saml/kit/builders/metadata_spec.rb
@@ -77,16 +77,16 @@ RSpec.describe Saml::Kit::Builders::Metadata do
 
   specify do
     configuration = Saml::Kit::Configuration.new do |config|
-      config.entity_id = "https://www.example.org/metadata"
+      config.entity_id = 'https://www.example.org/metadata'
       config.generate_key_pair_for(use: :signing)
       config.generate_key_pair_for(use: :encryption)
     end
     metadata = Saml::Kit::Metadata.build(configuration: configuration) do |x|
-      x.organization_name = "Acme"
-      x.contact_email = "acme@example.org"
-      x.organization_url = "https://www.example.org"
-      x.build_service_provider do |_|
-        _.add_assertion_consumer_service('https://www.example.org/assertions', binding: :http_post)
+      x.organization_name = 'Acme'
+      x.contact_email = 'acme@example.org'
+      x.organization_url = 'https://www.example.org'
+      x.build_service_provider do |xxx|
+        xxx.add_assertion_consumer_service('https://www.example.org/assertions', binding: :http_post)
       end
     end
     puts metadata.to_xml(pretty: true)
spec/saml/kit/response_spec.rb
@@ -569,9 +569,9 @@ RSpec.describe Saml::Kit::Response do
     end
 
     it 'parses an array of attributes' do
-      attributes[:roles] = [:admin, :user]
+      attributes[:roles] = %i[admin user]
       subject = described_class.build(user, request)
-      expect(subject.attributes[:roles]).to match_array(['admin', 'user'])
+      expect(subject.attributes[:roles]).to match_array(%w[admin user])
     end
   end