2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Projects > Members > Member leaves project' do
|
2016-08-24 12:49:21 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2018-03-17 18:26:18 +05:30
|
|
|
project.add_developer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user leaves project' do
|
2019-07-31 22:56:46 +05:30
|
|
|
visit project_path(project)
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
click_link 'Leave project'
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
expect(current_path).to eq(dashboard_projects_path)
|
|
|
|
expect(project.users.exists?(user.id)).to be_falsey
|
|
|
|
end
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
it 'user leaves project by url param', :js do
|
|
|
|
visit project_path(project, leave: 1)
|
|
|
|
|
|
|
|
page.accept_confirm
|
|
|
|
|
|
|
|
expect(find('.flash-notice')).to have_content "You left the \"#{project.full_name}\" project"
|
|
|
|
expect(current_path).to eq(dashboard_projects_path)
|
|
|
|
expect(project.users.exists?(user.id)).to be_falsey
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|