Commit 60f7d19a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix rubocop complains

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 940e504a
module GroupMembersHelper
def clear_ldap_permission_cache_message
markdown(<<-EOT.strip_heredoc
markdown(
<<-EOT.strip_heredoc
Be careful, all members of this group (except you) will have their
**access level temporarily downgraded** to `Guest`. The next time that a group member
signs in to GitLab (or after one hour, whichever occurs first) their access level will
......
......@@ -67,7 +67,7 @@ class JenkinsService < CiService
def build_page(sha, ref = nil)
if multiproject_enabled? && ref.present?
URI.encode("#{base_project_url}/#{project.name}_#{ref.gsub('/', '_')}/scm/bySHA1/#{sha}").to_s
URI.encode("#{base_project_url}/#{project.name}_#{ref.tr('/', '_')}/scm/bySHA1/#{sha}").to_s
else
"#{project_url}/scm/bySHA1/#{sha}"
end
......
......@@ -72,7 +72,7 @@ module API
expose :shared_runners_enabled
expose :creator_id
expose :namespace
expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ |project, options| project.forked? }
expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda { |project, options| project.forked? }
expose :avatar_url
expose :star_count, :forks_count
expose :open_issues_count, if: lambda { |project, options| project.issues_enabled? && project.default_issues_tracker? }
......@@ -90,7 +90,7 @@ module API
class Group < Grape::Entity
expose :id, :name, :path, :ldap_cn, :ldap_access, :description
expose :ldap_group_links, using: Entities::LdapGroupLink, if: lambda{ | group, options | group.ldap_group_links.any? }
expose :ldap_group_links, using: Entities::LdapGroupLink, if: lambda { |group, options| group.ldap_group_links.any? }
expose :avatar_url
expose :web_url do |group, options|
......
......@@ -211,7 +211,7 @@ describe Gitlab::LDAP::Access, lib: true do
it "should give admin privileges to an User" do
admin_group = Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com
%Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com
cn: #{access.admin_group}
description: GitLab admins
gidnumber: 42
......@@ -220,7 +220,7 @@ memberuid: admin2
memberuid: admin3
objectclass: top
objectclass: posixGroup
})
})
allow_any_instance_of(Gitlab::LDAP::Adapter).to receive(:group) { Gitlab::LDAP::Group.new(admin_group) }
expect{ access.update_admin_status }.to change(user, :admin?).to(true)
......@@ -229,7 +229,7 @@ objectclass: posixGroup
it "should remove admin privileges from an User" do
user.update_attribute(:admin, true)
admin_group = Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com
%Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com
cn: #{access.admin_group}
description: GitLab admins
gidnumber: 42
......@@ -237,7 +237,7 @@ memberuid: admin1
memberuid: admin3
objectclass: top
objectclass: posixGroup
})
})
allow_any_instance_of(Gitlab::LDAP::Adapter).to receive(:group) { Gitlab::LDAP::Group.new(admin_group) }
expect{ access.update_admin_status }.to change(user, :admin?).to(false)
end
......@@ -350,7 +350,7 @@ objectclass: posixGroup
describe 'ldap_groups' do
let(:ldap_group_1) do
Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=#{access.ldap_config.admin_group},ou=groups,dc=bar,dc=com
%Q{dn: cn=#{access.ldap_config.admin_group},ou=groups,dc=bar,dc=com
cn: #{access.ldap_config.admin_group}
description: GitLab group 1
gidnumber: 42
......@@ -358,7 +358,7 @@ memberuid: user1
memberuid: user2
objectclass: top
objectclass: posixGroup
})
})
end
it "returns an interator of LDAP Groups" do
......@@ -380,7 +380,7 @@ objectclass: posixGroup
describe :cns_with_access do
let(:ldap_group_response_1) do
Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=group1,ou=groups,dc=bar,dc=com
%Q{dn: cn=group1,ou=groups,dc=bar,dc=com
cn: group1
description: GitLab group 1
gidnumber: 21
......@@ -388,11 +388,12 @@ uniquemember: #{ldap_user.dn.downcase}
uniquemember: uid=user2,ou=people,dc=example
objectclass: top
objectclass: posixGroup
})
})
end
let(:ldap_group_response_2) do
Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=group2,ou=groups,dc=bar,dc=com
%Q{dn: cn=group2,ou=groups,dc=bar,dc=com
cn: group2
description: GitLab group 2
gidnumber: 42
......@@ -400,14 +401,16 @@ memberuid: user3
memberuid: user4
objectclass: top
objectclass: posixGroup
})
})
end
let(:ldap_groups) do
[
Gitlab::LDAP::Group.new(ldap_group_response_1),
Gitlab::LDAP::Group.new(ldap_group_response_2)
]
end
let(:ldap_user) { Gitlab::LDAP::Person.new(Net::LDAP::Entry.new, user.ldap_identity.provider) }
before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment