diff options
author | Vitaliy @blackst0ne Klachkov <blackst0ne.ru@gmail.com> | 2017-09-12 11:52:35 +1100 |
---|---|---|
committer | Vitaliy @blackst0ne Klachkov <blackst0ne.ru@gmail.com> | 2017-09-12 11:52:35 +1100 |
commit | 44a1759f191ef6b148eec93d2712897248e9f8e1 (patch) | |
tree | 2a1dddf0ca37b6734f38964bfa6fa6fe247caeaa /spec | |
parent | 021724eef20c9b7770119cd9ec367198f19cf442 (diff) | |
download | gitlab-ce-44a1759f191ef6b148eec93d2712897248e9f8e1.tar.gz |
Replace the 'project/merge_requests/revert.feature' spinach test with an rspec analog
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 |