2016-11-03 12:29:30 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
feature 'Projects > Members > Anonymous user sees members', js: true do
|
2016-11-03 12:29:30 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:group) { create(:group, :public) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :public) }
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
background do
|
|
|
|
project.team << [user, :master]
|
|
|
|
@group_link = create(:project_group_link, project: project, group: group)
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit project_settings_members_path(project)
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates group access level' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button @group_link.human_access
|
|
|
|
|
|
|
|
page.within '.dropdown-menu' do
|
|
|
|
click_link 'Guest'
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_settings_members_path(project)
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(first('.group_member')).to have_content('Guest')
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates expiry date' do
|
|
|
|
tomorrow = Date.today + 3
|
|
|
|
|
|
|
|
fill_in "member_expires_at_#{group.id}", with: tomorrow.strftime("%F")
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
page.within(find('li.group_member')) do
|
|
|
|
expect(page).to have_content('Expires in')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'deletes group link' do
|
|
|
|
page.within(first('.group_member')) do
|
|
|
|
find('.btn-remove').click
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_selector('.group_member')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'search' do
|
|
|
|
it 'finds no results' do
|
|
|
|
page.within '.member-search-form' do
|
|
|
|
fill_in 'search', with: 'testing 123'
|
|
|
|
find('.member-search-btn').click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).not_to have_selector('.group_member')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'finds results' do
|
|
|
|
page.within '.member-search-form' do
|
|
|
|
fill_in 'search', with: group.name
|
|
|
|
find('.member-search-btn').click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_selector('.group_member', count: 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|