summaryrefslogtreecommitdiff
path: root/features/steps/project/merge_requests/acceptance.rb
blob: 3c640e3512a1611465740fca213ea7fa736ae8b3 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
  include LoginHelpers
  include WaitForRequests

  step 'I am on the Merge Request detail page' do
    visit merge_request_path(@merge_request)
  end

  step 'I am on the Merge Request detail with note anchor page' do
    visit merge_request_path(@merge_request, anchor: 'note_123')
  end

  step 'I uncheck the "Remove source branch" option' do
    uncheck('Remove source branch')
  end

  step 'I check the "Remove source branch" option' do
    check('Remove source branch')
  end

  step 'I click on Accept Merge Request' do
    click_button('Merge')
  end

  step 'I should see the Remove Source Branch button' do
    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

  step 'I should not see the Remove Source Branch button' do
    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

  step 'There is an open Merge Request' do
    @user = create(:user)
    @project = create(:project, :public, :repository)
    @project_member = create(:project_member, :developer, user: @user, project: @project)
    @merge_request = create(:merge_request, :with_diffs, :simple, source_project: @project)
  end

  step 'I am signed in as a developer of the project' do
    sign_in(@user)
  end

  step 'I should see merge request merged' do
    expect(page).to have_content('The changes were merged into')
  end
end