Commit 9440b6a0 authored by Samantha Ming's avatar Samantha Ming Committed by Thong Kuah

Feature spec for squash option edge cases mentioned in part 2

parent 629c7f77
......@@ -17,6 +17,41 @@ RSpec.describe 'User edits a merge request', :js do
end
describe 'Squash commits' do
it 'override MR setting if "Required" is saved' do
merge_request.update!(squash: false)
project.project_setting.update!(squash_option: 'always')
visit(edit_project_merge_request_path(project, merge_request))
click_button('Save changes')
project.project_setting.update!(squash_option: 'default_off')
visit(edit_project_merge_request_path(project, merge_request))
expect(find("#merge_request_squash").selected?).to be(true)
end
it 'recovers MR squash setting if "Required" is not saved' do
merge_request.update!(squash: false)
project.project_setting.update!(squash_option: 'always')
visit(edit_project_merge_request_path(project, merge_request))
project.project_setting.update!(squash_option: 'default_on')
visit(edit_project_merge_request_path(project, merge_request))
expect(find("#merge_request_squash").selected?).to be(false)
end
it 'does not override MR squash setting if "Do not allow" is saved' do
merge_request.update!(squash: true)
project.project_setting.update!(squash_option: 'never')
visit(edit_project_merge_request_path(project, merge_request))
click_button('Save changes')
expect(merge_request.squash).to be true
end
it 'displays "Required in this project" for "Required" project setting squash option' do
project.project_setting.update!(squash_option: 'always')
visit(edit_project_merge_request_path(project, merge_request))
......
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