Commit e285fb50 authored by Małgorzata Ksionek's avatar Małgorzata Ksionek

Fix false positive specs

parent e4b2c3b0
...@@ -96,16 +96,20 @@ describe 'Private Group access' do ...@@ -96,16 +96,20 @@ describe 'Private Group access' do
describe 'GET /groups/:path for shared projects' do describe 'GET /groups/:path for shared projects' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
let(:linking_user) { create(:user) }
before do before do
group.add_guest(linking_user)
Projects::GroupLinks::CreateService.new( Projects::GroupLinks::CreateService.new(
project, project,
create(:user), linking_user,
link_group_access: ProjectGroupLink::DEVELOPER link_group_access: ProjectGroupLink::DEVELOPER
).execute(group) ).execute(group)
end end
subject { group_path(group) } subject { group_path(group) }
it { expect(group.shared_projects).not_to be_empty }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(group) } it { is_expected.to be_allowed_for(:owner).of(group) }
it { is_expected.to be_allowed_for(:maintainer).of(group) } it { is_expected.to be_allowed_for(:maintainer).of(group) }
......
...@@ -80,6 +80,8 @@ describe GroupPolicy do ...@@ -80,6 +80,8 @@ describe GroupPolicy do
let(:current_user) { nil } let(:current_user) { nil }
before do before do
group.add_developer(user)
Projects::GroupLinks::CreateService.new( Projects::GroupLinks::CreateService.new(
project, project,
user, user,
...@@ -87,7 +89,10 @@ describe GroupPolicy do ...@@ -87,7 +89,10 @@ describe GroupPolicy do
).execute(group) ).execute(group)
end end
it { expect_disallowed(:read_group) } it do
expect(group.shared_projects).not_to be_empty
expect_disallowed(:read_group)
end
end end
context 'with foreign user and public project' do context 'with foreign user and public project' do
...@@ -96,6 +101,8 @@ describe GroupPolicy do ...@@ -96,6 +101,8 @@ describe GroupPolicy do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
before do before do
group.add_developer(user)
Projects::GroupLinks::CreateService.new( Projects::GroupLinks::CreateService.new(
project, project,
user, user,
...@@ -103,7 +110,10 @@ describe GroupPolicy do ...@@ -103,7 +110,10 @@ describe GroupPolicy do
).execute(group) ).execute(group)
end end
it { expect_disallowed(:read_group) } it do
expect(group.shared_projects).not_to be_empty
expect_disallowed(:read_group)
end
end end
context 'has projects' do context 'has projects' 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