2016-12-02 09:34:08 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'Projects members' do
|
2016-12-02 09:34:08 -05:00
|
|
|
let(:user) { create(:user) }
|
2016-12-07 03:59:52 -05:00
|
|
|
let(:developer) { create(:user) }
|
|
|
|
let(:group) { create(:group, :public, :access_requestable) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, :public, :access_requestable, creator: user, group: group) }
|
2016-12-07 03:59:52 -05:00
|
|
|
let(:project_invitee) { create(:project_member, project: project, invite_token: '123', invite_email: 'test1@abc.com', user: nil) }
|
|
|
|
let(:group_invitee) { create(:group_member, group: group, invite_token: '123', invite_email: 'test2@abc.com', user: nil) }
|
|
|
|
let(:project_requester) { create(:user) }
|
|
|
|
let(:group_requester) { create(:user) }
|
2016-12-02 09:34:08 -05:00
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
before do
|
2017-12-22 03:18:28 -05:00
|
|
|
project.add_developer(developer)
|
2016-12-02 09:34:08 -05:00
|
|
|
group.add_owner(user)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-12-02 09:34:08 -05:00
|
|
|
end
|
|
|
|
|
2016-12-07 03:59:52 -05:00
|
|
|
context 'with a group invitee' do
|
|
|
|
before do
|
|
|
|
group_invitee
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_settings_members_path(project)
|
2016-12-07 03:59:52 -05:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'does not appear in the project members page' do
|
2016-12-07 03:59:52 -05:00
|
|
|
page.within first('.content-list') do
|
|
|
|
expect(page).not_to have_content('test2@abc.com')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with a group and a project invitee' do
|
|
|
|
before do
|
|
|
|
group_invitee
|
|
|
|
project_invitee
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_settings_members_path(project)
|
2016-12-07 03:59:52 -05:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'shows the project invitee, the project developer, and the group owner' do
|
2016-12-07 03:59:52 -05:00
|
|
|
page.within first('.content-list') do
|
|
|
|
expect(page).to have_content('test1@abc.com')
|
|
|
|
expect(page).not_to have_content('test2@abc.com')
|
|
|
|
|
|
|
|
# Project developer
|
|
|
|
expect(page).to have_content(developer.name)
|
|
|
|
|
|
|
|
# Group owner
|
|
|
|
expect(page).to have_content(user.name)
|
|
|
|
expect(page).to have_content(group.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with a group requester' do
|
|
|
|
before do
|
|
|
|
group.request_access(group_requester)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_settings_members_path(project)
|
2016-12-07 03:59:52 -05:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'does not appear in the project members page' do
|
2016-12-07 03:59:52 -05:00
|
|
|
page.within first('.content-list') do
|
|
|
|
expect(page).not_to have_content(group_requester.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with a group and a project requesters' do
|
|
|
|
before do
|
|
|
|
group.request_access(group_requester)
|
|
|
|
project.request_access(project_requester)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_settings_members_path(project)
|
2016-12-07 03:59:52 -05:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'shows the project requester, the project developer, and the group owner' do
|
2016-12-07 03:59:52 -05:00
|
|
|
page.within first('.content-list') do
|
|
|
|
expect(page).to have_content(project_requester.name)
|
|
|
|
expect(page).not_to have_content(group_requester.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within all('.content-list').last do
|
|
|
|
# Project developer
|
|
|
|
expect(page).to have_content(developer.name)
|
2016-12-02 09:34:08 -05:00
|
|
|
|
2016-12-07 03:59:52 -05:00
|
|
|
# Group owner
|
|
|
|
expect(page).to have_content(user.name)
|
|
|
|
expect(page).to have_content(group.name)
|
|
|
|
end
|
2016-12-02 09:34:08 -05:00
|
|
|
end
|
|
|
|
end
|
2018-07-16 12:18:52 -04:00
|
|
|
|
|
|
|
describe 'showing status of members' do
|
|
|
|
it_behaves_like 'showing user status' do
|
|
|
|
let(:user_with_status) { developer }
|
|
|
|
|
|
|
|
subject { visit project_settings_members_path(project) }
|
|
|
|
end
|
|
|
|
end
|
2016-12-02 09:34:08 -05:00
|
|
|
end
|