2016-09-13 17:45:13 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
describe 'Projects > Members > Maintainer adds member with expiration date', :js do
|
2016-09-13 17:45:13 +05:30
|
|
|
include Select2Helper
|
|
|
|
include ActiveSupport::Testing::TimeHelpers
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:maintainer) { create(:user) }
|
2016-09-13 17:45:13 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
let!(:new_member) { create(:user) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(maintainer)
|
|
|
|
sign_in(maintainer)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'expiration date is displayed in the members list' do
|
2016-09-13 17:45:13 +05:30
|
|
|
travel_to Time.zone.parse('2016-08-06 08:00') do
|
2017-08-17 22:00:37 +05:30
|
|
|
date = 4.days.from_now
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_project_members_path(project)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
page.within '.users-project-form' do
|
|
|
|
select2(new_member.id, from: '#user_ids', multiple: true)
|
2018-03-17 18:26:18 +05:30
|
|
|
fill_in 'expires_at', with: date.to_s(:medium) + "\n"
|
2016-11-03 12:29:30 +05:30
|
|
|
click_on 'Add to project'
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within "#project_member_#{new_member.project_members.first.id}" do
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_content('Expires in 4 days')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'change expiration date' do
|
2016-09-13 17:45:13 +05:30
|
|
|
travel_to Time.zone.parse('2016-08-06 08:00') do
|
2017-08-17 22:00:37 +05:30
|
|
|
date = 3.days.from_now
|
|
|
|
project.team.add_users([new_member.id], :developer, expires_at: Date.today.to_s(:medium))
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_project_members_path(project)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within "#project_member_#{new_member.project_members.first.id}" do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('.js-access-expiration-date').set date.to_s(:medium) + "\n"
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_content('Expires in 3 days')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|