it'shows a button to resolve all discussions by creating a new issue'do
within('li#resolve-count-app')do
expect(page).tohave_link"Resolve all discussions in new issue",href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
end
end
context'resolving the discussion'do
describe'as a user with access to the project'do
beforedo
click_button'Resolve discussion'
end
it'hides the link for creating a new issue'do
expect(page).not_tohave_link"Resolve all discussions in new issue",href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
click_link"Resolve all discussions in new issue",href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
it'shows a button to resolve all discussions by creating a new issue'do
within('li#resolve-count-app')do
expect(page).tohave_link"Resolve all discussions in new issue",href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
end
end
it_behaves_like'creating an issue for a discussion'
end
context'resolving the discussion'do
beforedo
click_button'Resolve discussion'
end
context'for a project where all discussions need to be resolved before merging'do
expect(page).not_tohave_link"Resolve all discussions in new issue",href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
click_link"Resolve all discussions in new issue",href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
end
it'does not show a link to create a new issue'do
expect(page).not_tohave_link'open an issue to resolve them later'
end
it_behaves_like'creating an issue for a discussion'
end
context'merge request has discussions that need to be resolved'do
context'for a project where all discussions need to be resolved before merging'do
it'has a link to resolve all discussions by creating an issue'do
page.within'.mr-widget-body'do
expect(page).tohave_link'open an issue to resolve them later',href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
it'does not show a link to create a new issue'do
expect(page).not_tohave_link'open an issue to resolve them later'
end
end
context'creating an issue for discussions'do
context'merge request has discussions that need to be resolved'do
beforedo
page.click_link'open an issue to resolve them later',href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
it'shows a warning that the merge request contains unresolved discussions'do
expect(page).tohave_content'This merge request has unresolved discussions'
end
it'has a link to resolve all discussions by creating an issue'do
page.within'.mr-widget-body'do
expect(page).tohave_link'open an issue to resolve them later',href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
end
end
it_behaves_like'creating an issue for a discussion'
context'creating an issue for discussions'do
beforedo
page.click_link'open an issue to resolve them later',href: new_namespace_project_issue_path(project.namespace,project,merge_request_for_resolving_discussions: merge_request.iid)
end
it_behaves_like'creating an issue for a discussion'
expect(page).tohave_link'Resolve this discussion in a new issue',href: new_issue_link
end
it'shows the link for creating a new issue when unresolving a discussion'do
page.within'.diff-content'do
click_button'Unresolve discussion'
context'creating the issue'do
beforedo
click_link'Resolve this discussion in a new issue',href: new_namespace_project_issue_path(project.namespace,project,discussion_to_resolve: discussion.id,merge_request_for_resolving_discussions: merge_request.iid)
end
expect(page).tohave_link'Resolve this discussion in a new issue'
expect(page).tohave_link'Resolve this discussion in a new issue',href: new_issue_link
it_behaves_like'creating an issue for a discussion'
end
end
context'creating the issue'do
describe'as a reporter'do
beforedo
click_link'Resolve this discussion in a new issue',href: new_namespace_project_issue_path(project.namespace,project,discussion_to_resolve: discussion.id,merge_request_for_resolving_discussions: merge_request.iid)