Commit 3bd8d227 authored by Thong Kuah's avatar Thong Kuah

Merge branch '17613-squash-option-spec-for-recovery' into 'master'

Feature spec for squash option edge cases mentioned in part 2

Closes #17613

See merge request gitlab-org/gitlab!35392
parents d1c59c6a 9440b6a0
...@@ -17,6 +17,41 @@ RSpec.describe 'User edits a merge request', :js do ...@@ -17,6 +17,41 @@ RSpec.describe 'User edits a merge request', :js do
end end
describe 'Squash commits' do 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 it 'displays "Required in this project" for "Required" project setting squash option' do
project.project_setting.update!(squash_option: 'always') project.project_setting.update!(squash_option: 'always')
visit(edit_project_merge_request_path(project, merge_request)) 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