From 714f264d62c5d2a45efc4b013f2fca1eb7eff1f1 Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Mon, 2 Oct 2017 15:00:50 -0700 Subject: [PATCH] Rename method to `to_normalized_s` --- db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb | 4 ++-- lib/gitlab/ldap/auth_hash.rb | 2 +- lib/gitlab/ldap/dn.rb | 2 +- lib/gitlab/ldap/person.rb | 2 +- spec/lib/gitlab/ldap/dn_spec.rb | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb b/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb index 501ba7c5fe2..aa95fa49e48 100644 --- a/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb +++ b/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb @@ -220,7 +220,7 @@ class NormalizeLdapExternUids < ActiveRecord::Migration ## # Return the DN as an escaped and normalized string. - def to_s_normalized + def to_normalized_s self.class.new(*to_a).to_s end @@ -270,7 +270,7 @@ class NormalizeLdapExternUids < ActiveRecord::Migration ldap_identities = Identity.where("provider like 'ldap%'") ldap_identities.find_each do |identity| begin - identity.extern_uid = Gitlab::LDAP::DN.new(identity.extern_uid).to_s_normalized + identity.extern_uid = Gitlab::LDAP::DN.new(identity.extern_uid).to_normalized_s unless identity.save say "Unable to normalize \"#{identity.extern_uid}\". Skipping." end diff --git a/lib/gitlab/ldap/auth_hash.rb b/lib/gitlab/ldap/auth_hash.rb index 2ea0a51b18f..b173b879f5f 100644 --- a/lib/gitlab/ldap/auth_hash.rb +++ b/lib/gitlab/ldap/auth_hash.rb @@ -4,7 +4,7 @@ module Gitlab module LDAP class AuthHash < Gitlab::OAuth::AuthHash def uid - Gitlab::LDAP::DN.new(super).to_s_normalized + Gitlab::LDAP::DN.new(super).to_normalized_s end private diff --git a/lib/gitlab/ldap/dn.rb b/lib/gitlab/ldap/dn.rb index 060f61d1a10..4ecb5566018 100644 --- a/lib/gitlab/ldap/dn.rb +++ b/lib/gitlab/ldap/dn.rb @@ -235,7 +235,7 @@ module Gitlab ## # Return the DN as an escaped and normalized string. - def to_s_normalized + def to_normalized_s self.class.new(*to_a).to_s.downcase end diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 44cb6a065c9..af8aab2444b 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -72,7 +72,7 @@ module Gitlab end def dn - DN.new(entry.dn).to_s_normalized + DN.new(entry.dn).to_normalized_s end private diff --git a/spec/lib/gitlab/ldap/dn_spec.rb b/spec/lib/gitlab/ldap/dn_spec.rb index 67a561854aa..9a1963e2194 100644 --- a/spec/lib/gitlab/ldap/dn_spec.rb +++ b/spec/lib/gitlab/ldap/dn_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe Gitlab::LDAP::DN do using RSpec::Parameterized::TableSyntax - describe '#to_s_normalized' do - subject { described_class.new(given).to_s_normalized } + describe '#to_normalized_s' do + subject { described_class.new(given).to_normalized_s } # Regarding the telephoneNumber test: #