2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
RSpec.shared_examples 'creating an issue for a thread' do
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
it 'has a mention of the discussion in the description' do
|
2017-08-17 22:00:37 +05:30
|
|
|
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
|
2021-04-29 21:17:54 +05:30
|
|
|
expect { click_button 'Create issue' }.to change { project.issues.reload.size }.by(1)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'resolves the discussion in the merge request' do
|
2021-04-29 21:17:54 +05:30
|
|
|
click_button 'Create issue'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
discussion.first_note.reload
|
|
|
|
|
|
|
|
expect(discussion.resolved?).to eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows a flash messaage after resolving a discussion' do
|
2021-04-29 21:17:54 +05:30
|
|
|
click_button 'Create issue'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
it 'has a hidden field for the merge request' do
|
|
|
|
merge_request_field = find('#merge_request_to_resolve_discussions_of', visible: false)
|
|
|
|
|
|
|
|
expect(merge_request_field.value).to eq(merge_request.iid.to_s)
|
|
|
|
end
|
|
|
|
end
|