diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-08 14:42:13 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-08 14:42:13 +0000 |
commit | e091352bffe0aab0c4d7a1a1c7c74bbbc769de17 (patch) | |
tree | 008d5c2d1c9a3ede37a7ae7e5315239b273afa95 /spec | |
parent | 28155c9580b72b991fc1b2165b589c882d1fdb11 (diff) | |
download | gitlab-ce-e091352bffe0aab0c4d7a1a1c7c74bbbc769de17.tar.gz |
added rspec test to test when user cant mergemerge-request-widget-source-branch-improvements
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/merge_request/user_sees_merge_widget_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index ffc16b42690..51a65407aec 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -1,6 +1,8 @@ require 'rails_helper' describe 'Merge request > User sees merge widget', :js do + include ProjectForksHelper + let(:project) { create(:project, :repository) } let(:project_only_mwps) { create(:project, :repository, only_allow_merge_if_pipeline_succeeds: true) } let(:user) { project.creator } @@ -289,6 +291,28 @@ describe 'Merge request > User sees merge widget', :js do end end + context 'user cannot merge project and cannot push to fork', :js do + let(:forked_project) { fork_project(project, nil, repository: true) } + let(:user2) { create(:user) } + + before do + project.add_developer(user2) + sign_out(:user) + sign_in(user2) + merge_request.update( + source_project: forked_project, + target_project: project, + merge_params: { 'force_remove_source_branch' => '1' } + ) + visit project_merge_request_path(project, merge_request) + end + + it 'user cannot remove source branch' do + expect(page).not_to have_field('remove-source-branch-input') + expect(page).to have_content('Removes source branch') + end + end + context 'ongoing merge process' do it 'shows Merging state' do allow_any_instance_of(MergeRequest).to receive(:merge_ongoing?).and_return(true) |