2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Members > Group member cannot leave group project' do
|
2016-06-22 15:30:34 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:project) { create(:project, namespace: group) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2016-06-22 15:30:34 +05:30
|
|
|
group.add_developer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user does not see a "Leave project" link' do
|
2019-07-31 22:56:46 +05:30
|
|
|
visit project_path(project)
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).not_to have_content 'Leave project'
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
it 'renders a flash message if attempting to leave by url', :js do
|
|
|
|
visit project_path(project, leave: 1)
|
|
|
|
|
|
|
|
expect(find('.flash-alert')).to have_content 'You do not have permission to leave this project'
|
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|