diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-11 19:45:45 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-11 19:45:45 +0300 |
commit | de14e9c20392c4edfb9ee05f8a3364d7510a4f99 (patch) | |
tree | 1b64a20695aad43e425dfb3c7807406691b7aace /spec | |
parent | 73a913f2b5f2a5dd36e13e09d74264d1da218d6a (diff) | |
parent | da31584deafb8346b7889a7e98c534a08f57f5d8 (diff) |
Merge branch 'replace_project_merge_requests_accept.feature' into 'master'
Replace the 'project/merge_requests/accept.feature' spinach test with an rspec analog
See merge request !14176
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb b/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb new file mode 100644 index 00000000000..6c0b5e279d5 --- /dev/null +++ b/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +describe 'User accepts 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) + end + + context 'with removing the source branch' do + before do + visit(merge_request_path(merge_request)) + end + + it 'accepts a merge request' do + check('Remove source branch') + click_button('Merge') + + expect(page).to have_content('The changes were merged into') + expect(page).not_to have_selector('.js-remove-branch-button') + + # Wait for View Resource requests to complete so they don't blow up if they are + # only handled after `DatabaseCleaner` has already run. + wait_for_requests + end + end + + context 'without removing the source branch' do + before do + visit(merge_request_path(merge_request)) + end + + it 'accepts a merge request' do + click_button('Merge') + + expect(page).to have_content('The changes were merged into') + expect(page).to have_selector('.js-remove-branch-button') + + # Wait for View Resource requests to complete so they don't blow up if they are + # only handled after `DatabaseCleaner` has already run + wait_for_requests + end + end + + context 'when a URL has an anchor' do + before do + visit(merge_request_path(merge_request, anchor: 'note_123')) + end + + it 'accepts a merge request' do + check('Remove source branch') + click_button('Merge') + + expect(page).to have_content('The changes were merged into') + expect(page).not_to have_selector('.js-remove-branch-button') + + # Wait for View Resource requests to complete so they don't blow up if they are + # only handled after `DatabaseCleaner` has already run + wait_for_requests + end + end +end |