diff options
Diffstat (limited to 'spec/features/user_sees_revert_modal_spec.rb')
-rw-r--r-- | spec/features/user_sees_revert_modal_spec.rb | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/spec/features/user_sees_revert_modal_spec.rb b/spec/features/user_sees_revert_modal_spec.rb index 331f51dad95..5edf8358244 100644 --- a/spec/features/user_sees_revert_modal_spec.rb +++ b/spec/features/user_sees_revert_modal_spec.rb @@ -7,26 +7,33 @@ RSpec.describe 'Merge request > User sees revert modal', :js, :sidekiq_might_not let(:user) { project.creator } let(:merge_request) { create(:merge_request, source_project: project) } + shared_examples 'showing the revert modal' do + it 'shows the revert modal' do + click_button('Revert') + + page.within('[data-testid="modal-commit"]') do + expect(page).to have_content 'Revert this merge request' + end + end + end + before do sign_in(user) visit(project_merge_request_path(project, merge_request)) click_button('Merge') wait_for_requests - - visit(merge_request_path(merge_request)) - click_link('Revert') end - it 'shows the revert modal' do - page.within('.modal-header') do - expect(page).to have_content 'Revert this merge request' - end + context 'without page reload after merge validates js correctly loaded' do + it_behaves_like 'showing the revert modal' end - it 'closes the revert modal with escape keypress' do - find('#modal-revert-commit').send_keys(:escape) + context 'with page reload validates js correctly loaded' do + before do + visit(merge_request_path(merge_request)) + end - expect(page).not_to have_selector('#modal-revert-commit', visible: true) + it_behaves_like 'showing the revert modal' end end |