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
|
2014-01-22 14:03:52 -05:00
|
|
|
let(:project) { create(:project) }
|
2012-11-05 22:31:55 -05:00
|
|
|
let(:issue) { create(:issue, project: project) }
|
2013-04-25 10:15:33 -04:00
|
|
|
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
|
2012-08-01 20:30:36 -04:00
|
|
|
let(:fred) do
|
2013-04-25 10:15:33 -04:00
|
|
|
u = create(:user, name: "fred")
|
|
|
|
project.team << [u, :master]
|
|
|
|
u
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
2015-05-21 17:49:06 -04:00
|
|
|
allow_any_instance_of(Commit).to receive(:title).
|
|
|
|
and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
2012-09-14 18:00:59 -04:00
|
|
|
|
2015-04-21 09:13:40 -04:00
|
|
|
let(:commit) { project.commit }
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
login_as :user
|
2013-01-04 11:50:31 -05:00
|
|
|
project.team << [@user, :developer]
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "for commits" do
|
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
|
|
|
|
include WaitForVueResource
|
|
|
|
|
2012-08-01 20:30:36 -04:00
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@other_issue = create(:issue,
|
|
|
|
author: @user,
|
|
|
|
assignee: @user,
|
|
|
|
project: project)
|
|
|
|
@issue = create(:issue,
|
2012-08-10 18:07:50 -04:00
|
|
|
author: @user,
|
|
|
|
assignee: @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")
|
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
|
2017-04-05 21:13:06 -04:00
|
|
|
|
|
|
|
it "renders updated subject once edited somewhere else in issues#show" do
|
|
|
|
visit namespace_project_issue_path(project.namespace, project, @issue)
|
|
|
|
@issue.update(title: "fix #{@other_issue.to_reference} and update")
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
expect(page).to have_text("fix #{@other_issue.to_reference} and update")
|
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "for merge requests" do
|
|
|
|
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
|