Update effected tests
This commit is contained in:
parent
617f43c74b
commit
1096040024
7 changed files with 45 additions and 47 deletions
|
@ -12,9 +12,6 @@ class ProjectPolicy < BasePolicy
|
|||
guest_access!
|
||||
public_access!
|
||||
|
||||
# Allow to read builds for internal projects
|
||||
can! :read_build if project.public_builds?
|
||||
|
||||
if project.request_access_enabled &&
|
||||
!(owner || user.admin? || project.team.member?(user) || project_group_member?(user))
|
||||
can! :request_access
|
||||
|
|
|
@ -9,7 +9,7 @@ module SharedProject
|
|||
|
||||
step "project exists in some group namespace" do
|
||||
@group = create(:group, name: 'some group')
|
||||
@project = create(:project, namespace: @group)
|
||||
@project = create(:project, namespace: @group, public_builds: false)
|
||||
end
|
||||
|
||||
# Create a specific project called "Shop"
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe "Private Project Access", feature: true do
|
||||
include AccessMatchers
|
||||
|
||||
let(:project) { create(:project, :private) }
|
||||
let(:project) { create(:project, :private, public_builds: false) }
|
||||
|
||||
describe "Project should be private" do
|
||||
describe '#private?' do
|
||||
|
@ -262,16 +262,15 @@ describe "Private Project Access", feature: true do
|
|||
it { is_expected.to be_denied_for(:visitor) }
|
||||
|
||||
context 'when public builds is enabled' do
|
||||
it { is_expected.to be_allowed_for guest }
|
||||
before do
|
||||
project.update(public_builds: true)
|
||||
end
|
||||
|
||||
it { is_expected.to be_allowed_for(:guest).of(project) }
|
||||
end
|
||||
|
||||
context 'when public buils are disabled' do
|
||||
before do
|
||||
project.public_builds = false
|
||||
project.save
|
||||
end
|
||||
|
||||
it { is_expected.to be_denied_for guest }
|
||||
it { is_expected.to be_denied_for(:guest).of(project) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -290,16 +289,15 @@ describe "Private Project Access", feature: true do
|
|||
it { is_expected.to be_denied_for(:visitor) }
|
||||
|
||||
context 'when public builds is enabled' do
|
||||
it { is_expected.to be_allowed_for guest }
|
||||
before do
|
||||
project.update(public_builds: true)
|
||||
end
|
||||
|
||||
it { is_expected.to be_allowed_for(:guest).of(project) }
|
||||
end
|
||||
|
||||
context 'when public buils are disabled' do
|
||||
before do
|
||||
project.public_builds = false
|
||||
project.save
|
||||
end
|
||||
|
||||
it { is_expected.to be_denied_for guest }
|
||||
it { is_expected.to be_denied_for(:guest).of(project) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -317,16 +315,15 @@ describe "Private Project Access", feature: true do
|
|||
it { is_expected.to be_denied_for(:visitor) }
|
||||
|
||||
context 'when public builds is enabled' do
|
||||
it { is_expected.to be_allowed_for guest }
|
||||
before do
|
||||
project.update(public_builds: true)
|
||||
end
|
||||
|
||||
it { is_expected.to be_allowed_for(:guest).of(project) }
|
||||
end
|
||||
|
||||
context 'when public buils are disabled' do
|
||||
before do
|
||||
project.public_builds = false
|
||||
project.save
|
||||
end
|
||||
|
||||
it { is_expected.to be_denied_for guest }
|
||||
it { is_expected.to be_denied_for(:guest).of(project) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -346,7 +343,11 @@ describe "Private Project Access", feature: true do
|
|||
it { is_expected.to be_denied_for(:visitor) }
|
||||
|
||||
context 'when public builds is enabled' do
|
||||
it { is_expected.to be_allowed_for guest }
|
||||
before do
|
||||
project.update(public_builds: true)
|
||||
end
|
||||
|
||||
it { is_expected.to be_allowed_for(:guest).of(project) }
|
||||
end
|
||||
|
||||
context 'when public buils are disabled' do
|
||||
|
@ -355,7 +356,7 @@ describe "Private Project Access", feature: true do
|
|||
project.save
|
||||
end
|
||||
|
||||
it { is_expected.to be_denied_for guest }
|
||||
it { is_expected.to be_denied_for(:guest).of(project) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::CycleAnalytics::Permissions do
|
||||
let(:project) { create(:empty_project) }
|
||||
let(:project) { create(:empty_project, public_builds: false) }
|
||||
let(:user) { create(:user) }
|
||||
|
||||
subject { described_class.get(user: user, project: project) }
|
||||
|
|
|
@ -111,34 +111,34 @@ describe ProjectPolicy, models: true do
|
|||
context 'guests' do
|
||||
let(:current_user) { guest }
|
||||
|
||||
context 'public builds enabled' do
|
||||
let(:reporter_public_build_permissions) do
|
||||
reporter_permissions - [:read_build, :read_pipeline]
|
||||
end
|
||||
let(:reporter_public_build_permissions) do
|
||||
reporter_permissions - [:read_build, :read_pipeline]
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to include(*guest_permissions)
|
||||
is_expected.not_to include(*reporter_public_build_permissions)
|
||||
is_expected.not_to include(*team_member_reporter_permissions)
|
||||
is_expected.not_to include(*developer_permissions)
|
||||
is_expected.not_to include(*master_permissions)
|
||||
is_expected.not_to include(*owner_permissions)
|
||||
end
|
||||
|
||||
context 'public builds enabled' do
|
||||
it do
|
||||
is_expected.to include(*guest_permissions)
|
||||
is_expected.not_to include(*reporter_public_build_permissions)
|
||||
is_expected.not_to include(*team_member_reporter_permissions)
|
||||
is_expected.not_to include(*developer_permissions)
|
||||
is_expected.not_to include(*master_permissions)
|
||||
is_expected.not_to include(*owner_permissions)
|
||||
is_expected.to include(:read_build, :read_pipeline)
|
||||
end
|
||||
end
|
||||
|
||||
context 'public builds disabled' do
|
||||
before do
|
||||
project.public_builds = false
|
||||
project.save
|
||||
project.update(public_builds: false)
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to include(*guest_permissions)
|
||||
is_expected.not_to include(*reporter_permissions)
|
||||
is_expected.not_to include(*team_member_reporter_permissions)
|
||||
is_expected.not_to include(*developer_permissions)
|
||||
is_expected.not_to include(*master_permissions)
|
||||
is_expected.not_to include(*owner_permissions)
|
||||
is_expected.not_to include(:read_build, :read_pipeline)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'cycle analytics events' do
|
||||
let(:user) { create(:user) }
|
||||
let(:project) { create(:project) }
|
||||
let(:project) { create(:project, public_builds: false) }
|
||||
let(:issue) { create(:issue, project: project, created_at: 2.days.ago) }
|
||||
|
||||
describe 'GET /:namespace/:project/cycle_analytics/events/issues' do
|
||||
|
|
|
@ -11,7 +11,7 @@ describe PipelineNotificationWorker do
|
|||
status: status)
|
||||
end
|
||||
|
||||
let(:project) { create(:project) }
|
||||
let(:project) { create(:project, public_builds: false) }
|
||||
let(:user) { create(:user) }
|
||||
let(:pusher) { user }
|
||||
let(:watcher) { pusher }
|
||||
|
|
Loading…
Reference in a new issue