BigW Consortium Gitlab

resolving_discussions_in_issues_shared_examples.rb 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
shared_examples 'creating an issue for a discussion' do
  it 'shows an issue with the title filled in' do
    title_field = page.find_field('issue[title]')

    expect(title_field.value).to include(merge_request.title)
  end

  it 'has a mention of the discussion in the description'  do
    description_field = page.find_field('issue[description]')

    expect(description_field.value).to include(discussion.first_note.note)
  end

  it 'can create a new issue for the project' do
    expect { click_button 'Submit issue' }.to change { project.issues.reload.size }.by(1)
  end

  it 'resolves the discussion in the merge request' do
    click_button 'Submit issue'

    discussion.first_note.reload

    expect(discussion.resolved?).to eq(true)
  end
25

26 27 28 29 30 31 32 33 34 35
  it 'shows a flash messaage after resolving a discussion' do
    click_button 'Submit issue'

    page.within '.flash-notice' do
      # Only check for the word 'Resolved' since the spec might have resolved
      # multiple discussions
      expect(page).to have_content('Resolved')
    end
  end

36
  it 'has a hidden field for the merge request' do
Bob Van Landuyt committed
37
    merge_request_field = find('#merge_request_to_resolve_discussions_of', visible: false)
38 39 40

    expect(merge_request_field.value).to eq(merge_request.iid.to_s)
  end
41
end