diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-02-17 05:15:08 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-02-19 21:14:55 +0300 |
commit | 87b076f2ce6a791f6173eedda3ad4505d165451c (patch) | |
tree | 033d48a80163b73df658b7c2c6733171c3ec7d13 /features/steps/project | |
parent | 28aaef24adba2b39e0744d888b0e02c7bdb95c0b (diff) |
Add some spinach specs
Diffstat (limited to 'features/steps/project')
-rw-r--r-- | features/steps/project/commits/revert.rb | 40 | ||||
-rw-r--r-- | features/steps/project/merge_requests/revert.rb | 56 |
2 files changed, 96 insertions, 0 deletions
diff --git a/features/steps/project/commits/revert.rb b/features/steps/project/commits/revert.rb new file mode 100644 index 00000000000..94a5d4e2e4d --- /dev/null +++ b/features/steps/project/commits/revert.rb @@ -0,0 +1,40 @@ +class Spinach::Features::RevertCommits < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include SharedDiffNote + include RepoHelpers + + step 'I click on commit link' do + visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id) + end + + 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 commit notice' do + page.should have_content('The commit has been successfully reverted.') + end + + step 'I should see a revert error' do + page.should have_content('Sorry, we cannot revert this commit 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 commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + end +end diff --git a/features/steps/project/merge_requests/revert.rb b/features/steps/project/merge_requests/revert.rb new file mode 100644 index 00000000000..c5a4cfce6f0 --- /dev/null +++ b/features/steps/project/merge_requests/revert.rb @@ -0,0 +1,56 @@ +class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps + include LoginHelpers + include GitlabRoutingHelper + + 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.') + 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('Accept Merge Request') + end + + step 'I am signed in as a developer of the project' do + login_as(@user) + end + + step 'There is an open Merge Request' do + @user = create(:user) + @project = create(:project, :public) + @project_member = create(:project_member, user: @user, project: @project, access_level: ProjectMember::DEVELOPER) + @merge_request = create(:merge_request, :with_diffs, :simple, source_project: @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 |