diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-12 09:37:40 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-12 09:37:40 +0300 |
commit | 19df4a8a875e7ebe0fb70b97080c75b89a7ac440 (patch) | |
tree | 34eadf3cfaf83817ec3c826a9de91a12dc4fcbc5 /spec | |
parent | 90ac1bfb55a4bbd297e66e5a8c7206f97d21ab92 (diff) | |
parent | 44a1759f191ef6b148eec93d2712897248e9f8e1 (diff) |
Merge branch 'replace_project_merge_requests_revert.feature' into 'master'
Replace the 'project/merge_requests/revert.feature' spinach test with an rspec analog
See merge request !14201
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/merge_requests/user_reverts_merge_request_spec.rb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/features/projects/merge_requests/user_reverts_merge_request_spec.rb b/spec/features/projects/merge_requests/user_reverts_merge_request_spec.rb new file mode 100644 index 00000000000..a41d683dbbb --- /dev/null +++ b/spec/features/projects/merge_requests/user_reverts_merge_request_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' + +describe 'User reverts a merge request', :js do + let(:merge_request) { create(:merge_request, :with_diffs, :simple, source_project: project) } + let(:project) { create(:project, :public, :repository) } + let(:user) { create(:user) } + + before do + project.add_developer(user) + sign_in(user) + + visit(merge_request_path(merge_request)) + + click_button('Merge') + + visit(merge_request_path(merge_request)) + end + + it 'reverts a merge request' do + find("a[href='#modal-revert-commit']").click + + page.within('#modal-revert-commit') do + uncheck('create_merge_request') + click_button('Revert') + end + + expect(page).to have_content('The merge request has been successfully reverted.') + + wait_for_requests + end + + it 'does not revert a merge request that was previously reverted' do + find("a[href='#modal-revert-commit']").click + + page.within('#modal-revert-commit') do + uncheck('create_merge_request') + click_button('Revert') + end + + find("a[href='#modal-revert-commit']").click + + page.within('#modal-revert-commit') do + uncheck('create_merge_request') + click_button('Revert') + end + + expect(page).to have_content('Sorry, we cannot revert this merge request automatically.') + end + + it 'reverts a merge request in a new merge request' do + find("a[href='#modal-revert-commit']").click + + page.within('#modal-revert-commit') do + click_button('Revert') + end + + expect(page).to have_content('The merge request has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + end +end |