Commit cdb7a5da authored by Imre Farkas's avatar Imre Farkas

Merge branch 'additional-pending-membership-specs' into 'master'

Add Feature Specs for Pending Group and Project Memberships

See merge request gitlab-org/gitlab!80943
parents a334f66e 6431e85b
......@@ -34,6 +34,19 @@ RSpec.describe 'Pending group memberships', :js do
expect(page).not_to have_content "Recent activity"
end
it 'a pending member sees a public group with a private project as if not a member' do
create(:project, :private, namespace: group)
create(:group_member, :awaiting, :developer, source: group, user: developer)
visit group_path(group)
expect(page).to have_content "Group ID: #{group.id}"
expect(page).to have_content "A group is a collection of several projects"
expect(page).to have_content "No groups or projects matched your search"
expect(page).not_to have_content "New project"
expect(page).not_to have_content "Recent activity"
end
it 'a pending group member gets a 404 for a private project in the group' do
project = create(:project, :private, namespace: group)
create(:group_member, :awaiting, :developer, source: group, user: developer)
......@@ -42,6 +55,18 @@ RSpec.describe 'Pending group memberships', :js do
expect(page).to have_content "Page Not Found"
end
it 'a group member can see a private project in the group once the pending membership transitions to active' do
project = create(:project, :private, namespace: group)
membership = create(:group_member, :awaiting, :developer, source: group, user: developer)
membership.activate!
visit project_path(project)
expect(page).to have_content project.name
expect(page).to have_content "The repository for this project does not exist."
end
end
context 'with a private group' do
......@@ -54,6 +79,15 @@ RSpec.describe 'Pending group memberships', :js do
expect(page).to have_content 'Page Not Found'
end
it 'a pending member gets a 404 for a private group with a project' do
create(:project, namespace: group)
create(:group_member, :awaiting, :developer, source: group, user: developer)
visit group_path(group)
expect(page).to have_content 'Page Not Found'
end
end
context 'with a subgroup' do
......
......@@ -35,6 +35,16 @@ RSpec.describe 'Pending project memberships', :js do
expect(page).to have_content "Group ID: #{group.id}"
expect(page).to have_content project.name
end
context 'when a pending group membership is created with an existing pending project membership' do
it "a pending member gets a 404 for the project's private group" do
create(:group_member, :awaiting, :developer, source: group, user: developer)
visit group_path(group)
expect(page).to have_content "Page Not Found"
end
end
end
context 'with a public project in a public group' 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