2012-08-01 20:30:36 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2014-04-12 04:56:37 -04:00
|
|
|
describe "GitLab Flavored Markdown", feature: true do
|
2017-03-28 17:13:16 -04:00
|
|
|
let(:project) { create(:empty_project) }
|
2012-11-05 22:31:55 -05:00
|
|
|
let(:issue) { create(:issue, project: project) }
|
2012-08-01 20:30:36 -04:00
|
|
|
let(:fred) do
|
2017-03-28 17:13:16 -04:00
|
|
|
create(:user, name: 'fred') do |user|
|
|
|
|
project.add_master(user)
|
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
2017-03-28 17:13:16 -04:00
|
|
|
login_as(:user)
|
|
|
|
project.add_developer(@user)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
2012-09-14 18:00:59 -04:00
|
|
|
|
2017-03-28 17:13:16 -04:00
|
|
|
describe "for commits" do
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:commit) { project.commit }
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2017-03-28 17:13:16 -04:00
|
|
|
before do
|
|
|
|
allow_any_instance_of(Commit).to receive(:title).
|
|
|
|
and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
|
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in commits#index" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in commits#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_commit_path(project.namespace, project, commit)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders description in commits#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_commit_path(project.namespace, project, commit)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(fred.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in repositories#branches" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_branches_path(project.namespace, project)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-04-05 21:13:06 -04:00
|
|
|
describe "for issues", feature: true, js: true do
|
2012-08-01 20:30:36 -04:00
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@other_issue = create(:issue,
|
|
|
|
author: @user,
|
2017-05-04 08:11:15 -04:00
|
|
|
assignees: [@user],
|
2012-11-05 22:31:55 -05:00
|
|
|
project: project)
|
|
|
|
@issue = create(:issue,
|
2012-08-10 18:07:50 -04:00
|
|
|
author: @user,
|
2017-05-04 08:11:15 -04:00
|
|
|
assignees: [@user],
|
2012-11-05 22:31:55 -05:00
|
|
|
project: project,
|
2015-05-21 16:35:15 -04:00
|
|
|
title: "fix #{@other_issue.to_reference}",
|
|
|
|
description: "ask #{fred.to_reference} for details")
|
2017-05-03 13:41:16 -04:00
|
|
|
|
|
|
|
@note = create(:note_on_issue, noteable: @issue, project: @issue.project, note: "Hello world")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders subject in issues#index" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_issues_path(project.namespace, project)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(@other_issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders subject in issues#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_issue_path(project.namespace, project, @issue)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(@other_issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders details in issues#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_issue_path(project.namespace, project, @issue)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-08-31 18:09:18 -04:00
|
|
|
expect(page).to have_link(fred.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "for merge requests" do
|
2017-03-28 17:13:16 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
2012-08-01 20:30:36 -04:00
|
|
|
before do
|
2015-05-21 16:35:15 -04:00
|
|
|
@merge_request = create(:merge_request, source_project: project, target_project: project, title: "fix #{issue.to_reference}")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in merge_requests#index" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_merge_requests_path(project.namespace, project)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in merge_requests#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_merge_request_path(project.namespace, project, @merge_request)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "for milestones" do
|
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@milestone = create(:milestone,
|
|
|
|
project: project,
|
2015-05-21 16:35:15 -04:00
|
|
|
title: "fix #{issue.to_reference}",
|
|
|
|
description: "ask #{fred.to_reference} for details")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in milestones#index" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_milestones_path(project.namespace, project)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in milestones#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_milestone_path(project.namespace, project, @milestone)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(issue.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders description in milestones#show" do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_milestone_path(project.namespace, project, @milestone)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2015-05-21 16:35:15 -04:00
|
|
|
expect(page).to have_link(fred.to_reference)
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|