diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-12 06:37:40 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-12 06:37:40 +0000 |
commit | 19df4a8a875e7ebe0fb70b97080c75b89a7ac440 (patch) | |
tree | 34eadf3cfaf83817ec3c826a9de91a12dc4fcbc5 | |
parent | 90ac1bfb55a4bbd297e66e5a8c7206f97d21ab92 (diff) | |
parent | 44a1759f191ef6b148eec93d2712897248e9f8e1 (diff) | |
download | gitlab-ce-19df4a8a875e7ebe0fb70b97080c75b89a7ac440.tar.gz |
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
4 files changed, 65 insertions, 85 deletions
diff --git a/changelogs/unreleased/replace_project_merge_requests_revert-feature.yml b/changelogs/unreleased/replace_project_merge_requests_revert-feature.yml new file mode 100644 index 00000000000..7d1ab4566b6 --- /dev/null +++ b/changelogs/unreleased/replace_project_merge_requests_revert-feature.yml @@ -0,0 +1,6 @@ +--- +title: Replace the 'project/merge_requests/revert.feature' spinach test with an rspec + analog +merge_request: 14201 +author: Vitaliy @blackst0ne Klachkov +type: other diff --git a/features/project/merge_requests/revert.feature b/features/project/merge_requests/revert.feature deleted file mode 100644 index aaac5fd7209..00000000000 --- a/features/project/merge_requests/revert.feature +++ /dev/null @@ -1,29 +0,0 @@ -@project_merge_requests -Feature: Revert Merge Requests - Background: - Given There is an open Merge Request - And I am signed in as a developer of the project - And I am on the Merge Request detail page - And I click on Accept Merge Request - And I am on the Merge Request detail page - - @javascript - Scenario: I revert a merge request - Given I click on the revert button - And I revert the changes directly - Then I should see the revert merge request notice - - @javascript - Scenario: I revert a merge request that was previously reverted - Given I click on the revert button - And I revert the changes directly - And I am on the Merge Request detail page - And I click on the revert button - And I revert the changes directly - Then I should see a revert error - - @javascript - Scenario: I revert a merge request in a new merge request - Given I click on the revert button - And I revert the changes in a new merge request - Then I should see the new merge request notice diff --git a/features/steps/project/merge_requests/revert.rb b/features/steps/project/merge_requests/revert.rb deleted file mode 100644 index 25ccf5ab180..00000000000 --- a/features/steps/project/merge_requests/revert.rb +++ /dev/null @@ -1,56 +0,0 @@ -class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps - include LoginHelpers - include WaitForRequests - - step 'I click on the revert button' do - find("a[href='#modal-revert-commit']").click - end - - step 'I revert the changes directly' do - page.within('#modal-revert-commit') do - uncheck 'create_merge_request' - click_button 'Revert' - end - end - - step 'I should see the revert merge request notice' do - page.should have_content('The merge request has been successfully reverted.') - wait_for_requests - end - - step 'I should not see the revert button' do - expect(page).not_to have_selector(:xpath, "a[href='#modal-revert-commit']") - end - - step 'I am on the Merge Request detail page' do - visit merge_request_path(@merge_request) - end - - step 'I click on Accept Merge Request' do - click_button('Merge') - end - - step 'I am signed in as a developer of the project' do - @user = create(:user) { |u| @project.add_developer(u) } - sign_in(@user) - end - - step 'There is an open Merge Request' do - @merge_request = create(:merge_request, :with_diffs, :simple) - @project = @merge_request.source_project - end - - step 'I should see a revert error' do - page.should have_content('Sorry, we cannot revert this merge request automatically.') - end - - step 'I revert the changes in a new merge request' do - page.within('#modal-revert-commit') do - click_button 'Revert' - end - end - - step 'I should see the new merge request notice' do - page.should 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 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 |