Commit 5514552c authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-ee-rubocop-dot-position-cop' into 'master'

Fix remaining DotPosition cops 👮

Closes #2710

See merge request !2211
parents 8038cdac 95197a13
...@@ -33,8 +33,8 @@ class EventsFinder ...@@ -33,8 +33,8 @@ class EventsFinder
private private
def by_current_user_access(events) def by_current_user_access(events)
events.merge(ProjectsFinder.new(current_user: current_user).execute). events.merge(ProjectsFinder.new(current_user: current_user).execute)
joins(:project) .joins(:project)
end end
def by_action(events) def by_action(events)
......
...@@ -275,10 +275,10 @@ class Project < ActiveRecord::Base ...@@ -275,10 +275,10 @@ class Project < ActiveRecord::Base
# logged in user. # logged in user.
def self.public_or_visible_to_user(user = nil) def self.public_or_visible_to_user(user = nil)
if user if user
authorized = user. authorized = user
project_authorizations. .project_authorizations
select(1). .select(1)
where('project_authorizations.project_id = projects.id') .where('project_authorizations.project_id = projects.id')
levels = Gitlab::VisibilityLevel.levels_for_user(user) levels = Gitlab::VisibilityLevel.levels_for_user(user)
...@@ -303,11 +303,11 @@ class Project < ActiveRecord::Base ...@@ -303,11 +303,11 @@ class Project < ActiveRecord::Base
elsif user elsif user
column = ProjectFeature.quoted_access_level_column(feature) column = ProjectFeature.quoted_access_level_column(feature)
authorized = user.project_authorizations.select(1). authorized = user.project_authorizations.select(1)
where('project_authorizations.project_id = projects.id') .where('project_authorizations.project_id = projects.id')
with_project_feature. with_project_feature
where("#{column} IN (?) OR (#{column} = ? AND EXISTS (?))", .where("#{column} IN (?) OR (#{column} = ? AND EXISTS (?))",
visible, visible,
ProjectFeature::PRIVATE, ProjectFeature::PRIVATE,
authorized) authorized)
......
...@@ -176,8 +176,8 @@ describe ProjectsController do ...@@ -176,8 +176,8 @@ describe ProjectsController do
context 'project repo over limit' do context 'project repo over limit' do
before do before do
allow_any_instance_of(EE::Project). allow_any_instance_of(EE::Project)
to receive(:above_size_limit?).and_return(true) .to receive(:above_size_limit?).and_return(true)
project.team << [user, :master] project.team << [user, :master]
end end
......
...@@ -5,10 +5,10 @@ describe Gitlab::VisibilityLevel, lib: true do # rubocop:disable RSpec/FilePath ...@@ -5,10 +5,10 @@ describe Gitlab::VisibilityLevel, lib: true do # rubocop:disable RSpec/FilePath
it 'returns all levels for an auditor' do it 'returns all levels for an auditor' do
user = build(:user, :auditor) user = build(:user, :auditor)
expect(described_class.levels_for_user(user)). expect(described_class.levels_for_user(user))
to eq([Gitlab::VisibilityLevel::PRIVATE, .to eq([Gitlab::VisibilityLevel::PRIVATE,
Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC]) Gitlab::VisibilityLevel::PUBLIC])
end end
end end
end end
...@@ -23,30 +23,30 @@ describe Gitlab::VisibilityLevel, lib: true do ...@@ -23,30 +23,30 @@ describe Gitlab::VisibilityLevel, lib: true do
it 'returns all levels for an admin' do it 'returns all levels for an admin' do
user = build(:user, :admin) user = build(:user, :admin)
expect(described_class.levels_for_user(user)). expect(described_class.levels_for_user(user))
to eq([Gitlab::VisibilityLevel::PRIVATE, .to eq([Gitlab::VisibilityLevel::PRIVATE,
Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC]) Gitlab::VisibilityLevel::PUBLIC])
end end
it 'returns INTERNAL and PUBLIC for internal users' do it 'returns INTERNAL and PUBLIC for internal users' do
user = build(:user) user = build(:user)
expect(described_class.levels_for_user(user)). expect(described_class.levels_for_user(user))
to eq([Gitlab::VisibilityLevel::INTERNAL, .to eq([Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC]) Gitlab::VisibilityLevel::PUBLIC])
end end
it 'returns PUBLIC for external users' do it 'returns PUBLIC for external users' do
user = build(:user, :external) user = build(:user, :external)
expect(described_class.levels_for_user(user)). expect(described_class.levels_for_user(user))
to eq([Gitlab::VisibilityLevel::PUBLIC]) .to eq([Gitlab::VisibilityLevel::PUBLIC])
end end
it 'returns PUBLIC when no user is given' do it 'returns PUBLIC when no user is given' do
expect(described_class.levels_for_user). expect(described_class.levels_for_user)
to eq([Gitlab::VisibilityLevel::PUBLIC]) .to eq([Gitlab::VisibilityLevel::PUBLIC])
end end
end end
end end
...@@ -768,8 +768,8 @@ describe 'Git HTTP requests', lib: true do ...@@ -768,8 +768,8 @@ describe 'Git HTTP requests', lib: true do
end end
it 'responds with status 403 Forbidden' do it 'responds with status 403 Forbidden' do
allow_any_instance_of(EE::Project). allow_any_instance_of(EE::Project)
to receive(:above_size_limit?).and_return(true) .to receive(:above_size_limit?).and_return(true)
upload(path, env) do |response| upload(path, env) do |response|
expect(response).to have_http_status(:forbidden) expect(response).to have_http_status(:forbidden)
......
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