2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Projects > Members > Member leaves project', feature_category: :subgroups do
|
2023-06-20 00:43:36 +05:30
|
|
|
include Features::MembersHelpers
|
2022-07-23 23:45:48 +05:30
|
|
|
include Spec::Support::Helpers::ModalHelpers
|
2022-04-04 11:22:00 +05:30
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
let(:user) { create(:user) }
|
2022-07-16 23:28:13 +05:30
|
|
|
let(:project) { create(:project, :repository, :with_namespace_settings) }
|
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
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
expect(page).to have_current_path(dashboard_projects_path, ignore_query: true)
|
2016-08-24 12:49:21 +05:30
|
|
|
expect(project.users.exists?(user.id)).to be_falsey
|
|
|
|
end
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
it 'user leaves project by url param', :js do
|
2019-07-31 22:56:46 +05:30
|
|
|
visit project_path(project, leave: 1)
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
accept_gl_confirm(button_text: 'Leave project')
|
2022-04-04 11:22:00 +05:30
|
|
|
wait_for_all_requests
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
expect(page).to have_current_path(dashboard_projects_path, ignore_query: true)
|
2022-04-04 11:22:00 +05:30
|
|
|
|
|
|
|
sign_in(project.first_owner)
|
|
|
|
|
|
|
|
visit project_project_members_path(project)
|
|
|
|
|
|
|
|
expect(members_table).not_to have_content(user.name)
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|