Address Douwe's feedback
- Make it more explicit that `source` must respond to `#group` and that `#group` must be present. - Indent subsequent lines of a multi-line condition. Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
e71ce77e39
commit
7c9571a3ba
|
@ -1,5 +1,5 @@
|
||||||
- member = source.members.find_by(user_id: current_user.id)
|
- member = source.members.find_by(user_id: current_user.id)
|
||||||
- group_member = source.group.members.find_by(user_id: current_user.id) if source.try(:group)
|
- group_member = source.group.members.find_by(user_id: current_user.id) if source.respond_to?(:group) && source.group
|
||||||
|
|
||||||
- unless group_member
|
- unless group_member
|
||||||
- if member
|
- if member
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
feature 'Projects > Members > Group member cannot request access to his group project', feature: true do
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
let(:group) { create(:group) }
|
||||||
|
let(:project) { create(:project, namespace: group) }
|
||||||
|
|
||||||
|
background do
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'owner does not see the request access button' do
|
||||||
|
group.add_owner(user)
|
||||||
|
login_and_visit_project_page(user)
|
||||||
|
|
||||||
|
expect(page).not_to have_content 'Request Access'
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'master does not see the request access button' do
|
||||||
|
group.add_master(user)
|
||||||
|
login_and_visit_project_page(user)
|
||||||
|
|
||||||
|
expect(page).not_to have_content 'Request Access'
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'developer does not see the request access button' do
|
||||||
|
group.add_developer(user)
|
||||||
|
login_and_visit_project_page(user)
|
||||||
|
|
||||||
|
expect(page).not_to have_content 'Request Access'
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'reporter does not see the request access button' do
|
||||||
|
group.add_reporter(user)
|
||||||
|
login_and_visit_project_page(user)
|
||||||
|
|
||||||
|
expect(page).not_to have_content 'Request Access'
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'guest does not see the request access button' do
|
||||||
|
group.add_guest(user)
|
||||||
|
login_and_visit_project_page(user)
|
||||||
|
|
||||||
|
expect(page).not_to have_content 'Request Access'
|
||||||
|
end
|
||||||
|
|
||||||
|
def login_and_visit_project_page(user)
|
||||||
|
login_as(user)
|
||||||
|
visit namespace_project_path(project.namespace, project)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,17 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
feature 'Projects > Members > Group owner cannot request access to his group project', feature: true do
|
|
||||||
let(:owner) { create(:user) }
|
|
||||||
let(:group) { create(:group) }
|
|
||||||
let(:project) { create(:project, namespace: group) }
|
|
||||||
|
|
||||||
background do
|
|
||||||
group.add_owner(owner)
|
|
||||||
login_as(owner)
|
|
||||||
visit namespace_project_path(project.namespace, project)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'owner does not see the request access button' do
|
|
||||||
expect(page).not_to have_content 'Request Access'
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue