user_sees_revert_modal_spec.rb 754 Bytes
Newer Older
1 2
require 'rails_helper'

3
describe 'Merge request > User sees revert modal', :js do
4 5 6 7 8 9
  let(:project) { create(:project, :public, :repository) }
  let(:user) { project.creator }
  let(:merge_request) { create(:merge_request, source_project: project) }

  before do
    sign_in(user)
10
    visit(project_merge_request_path(project, merge_request))
11
    click_button('Merge')
12 13 14

    wait_for_requests

15 16 17 18 19 20 21 22 23 24 25 26 27 28
    visit(merge_request_path(merge_request))
    click_link('Revert')
  end

  it 'shows the revert modal' do
    expect(page).to have_content('Revert this merge request')
  end

  it 'closes the revert modal with escape keypress' do
    find('#modal-revert-commit').send_keys(:escape)

    expect(page).not_to have_content('Revert this merge request')
  end
end