Commit e091352b authored by Phil Hughes's avatar Phil Hughes

added rspec test to test when user cant merge

parent 28155c95
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment