diff options
author | Vitaliy @blackst0ne Klachkov <blackst0ne.ru@gmail.com> | 2017-09-18 16:15:42 +1100 |
---|---|---|
committer | Vitaliy @blackst0ne Klachkov <blackst0ne.ru@gmail.com> | 2017-09-18 16:15:42 +1100 |
commit | b5a091e3a4c01374138b3b327ec8cde3c23bef69 (patch) | |
tree | e4ced1f34035158a6d4e73d86bb39b6b30ea7451 /spec/features/projects/commit/user_reverts_commit_spec.rb | |
parent | 2defc7b931ac46603780944907d7e19233ad1e97 (diff) | |
download | gitlab-ce-b5a091e3a4c01374138b3b327ec8cde3c23bef69.tar.gz |
Replace the 'project/commits/revert.feature' spinach test with an rspec analog
Diffstat (limited to 'spec/features/projects/commit/user_reverts_commit_spec.rb')
-rw-r--r-- | spec/features/projects/commit/user_reverts_commit_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/features/projects/commit/user_reverts_commit_spec.rb b/spec/features/projects/commit/user_reverts_commit_spec.rb new file mode 100644 index 00000000000..221f1d7757e --- /dev/null +++ b/spec/features/projects/commit/user_reverts_commit_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper' + +describe 'User reverts a commit', :js do + include RepoHelpers + + let(:project) { create(:project, :repository, namespace: user.namespace) } + let(:user) { create(:user) } + + before do + sign_in(user) + + visit(project_commit_path(project, sample_commit.id)) + + find('.header-action-buttons .dropdown').click + find('a[href="#modal-revert-commit"]').click + end + + context 'without creating a new merge request' do + before do + page.within('#modal-revert-commit') do + uncheck('create_merge_request') + click_button('Revert') + end + end + + it 'reverts a commit' do + expect(page).to have_content('The commit has been successfully reverted.') + end + + it 'does not revert a previously reverted commit' do + # Visit the comment again once it was reverted. + visit project_commit_path(project, sample_commit.id) + + find('.header-action-buttons .dropdown').click + 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 commit automatically.') + end + end + + context 'with creating a new merge request' do + it 'reverts a commit' do + page.within('#modal-revert-commit') do + click_button('Revert') + end + + expect(page).to have_content('The commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + expect(page).to have_content("From revert-#{Commit.truncate_sha(sample_commit.id)} into master") + end + end +end |