2012-08-01 20:30:36 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
describe "GitLab Flavored Markdown" do
|
2017-06-19 22:06:13 -04:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(: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|
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-03-28 17:13:16 -04:00
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
2017-06-19 22:06:13 -04:00
|
|
|
sign_in(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
|
2017-06-21 09:48:12 -04:00
|
|
|
allow_any_instance_of(Commit).to receive(:title)
|
|
|
|
.and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
|
2017-03-28 17:13:16 -04:00
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "renders title in commits#index" do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_commits_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_commit_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_commit_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_branches_path(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-10-03 04:35:01 -04:00
|
|
|
describe "for issues", :js do
|
2012-08-01 20:30:36 -04:00
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@other_issue = create(:issue,
|
2017-06-19 22:06:13 -04:00
|
|
|
author: user,
|
|
|
|
assignees: [user],
|
2012-11-05 22:31:55 -05:00
|
|
|
project: project)
|
|
|
|
@issue = create(:issue,
|
2017-06-19 22:06:13 -04:00
|
|
|
author: user,
|
|
|
|
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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_issues_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_issue_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_issue_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_merge_requests_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_merge_request_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_milestones_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_milestone_path(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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_milestone_path(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
|