summaryrefslogtreecommitdiff
path: root/spec/features/user_sees_revert_modal_spec.rb
blob: 24b4f8dd4aa81c5a944f5f3ba0f6c1bc2e04f732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'spec_helper'

describe 'Merge request > User sees revert modal', :js do
  let(:project) { create(:project, :public, :repository) }
  let(:user) { project.creator }
  let(:merge_request) { create(:merge_request, source_project: project) }

  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
  end

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

    expect(page).not_to have_selector('#modal-revert-commit', visible: true)
  end
end