2012-08-01 20:30:36 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Gitlab Flavored Markdown" do
|
2012-11-05 22:31:55 -05:00
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
let(:merge_request) { create(:merge_request, project: project) }
|
2012-08-01 20:30:36 -04:00
|
|
|
let(:fred) do
|
2012-11-05 22:31:55 -05:00
|
|
|
u = create(:user, name: "fred")
|
2013-01-04 11:50:31 -05:00
|
|
|
project.team << [u, :master]
|
2012-08-01 20:30:36 -04:00
|
|
|
u
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
# add test branch
|
|
|
|
@branch_name = "gfm-test"
|
|
|
|
r = project.repo
|
|
|
|
i = r.index
|
|
|
|
# add test file
|
|
|
|
@test_file = "gfm_test_file"
|
|
|
|
i.add(@test_file, "foo\nbar\n")
|
|
|
|
# add commit with gfm
|
2012-12-06 22:40:42 -05:00
|
|
|
i.commit("fix ##{issue.id}\n\nask @#{fred.username} for details", head: @branch_name)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
# add test tag
|
|
|
|
@tag_name = "gfm-test-tag"
|
|
|
|
r.git.native(:tag, {}, @tag_name, commit.id)
|
|
|
|
end
|
2012-09-14 18:00:59 -04:00
|
|
|
|
2012-08-01 20:30:36 -04:00
|
|
|
after do
|
|
|
|
# delete test branch and tag
|
2012-08-10 18:07:50 -04:00
|
|
|
project.repo.git.native(:branch, {D: true}, @branch_name)
|
|
|
|
project.repo.git.native(:tag, {d: true}, @tag_name)
|
2012-08-01 20:30:36 -04:00
|
|
|
project.repo.gc_auto
|
|
|
|
end
|
|
|
|
|
2013-01-04 11:50:31 -05:00
|
|
|
let(:commit) { project.repository.commits(@branch_name).first }
|
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
|
|
|
|
it "should render title in commits#index" do
|
2012-09-26 13:43:42 -04:00
|
|
|
visit project_commits_path(project, @branch_name, limit: 1)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render title in commits#show" do
|
2012-09-17 10:06:56 -04:00
|
|
|
visit project_commit_path(project, commit)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render description in commits#show" do
|
2012-09-17 10:06:56 -04:00
|
|
|
visit project_commit_path(project, commit)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
2012-12-06 22:40:42 -05:00
|
|
|
page.should have_link("@#{fred.username}")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
2012-08-10 18:07:50 -04:00
|
|
|
it "should render title in refs#tree", js: true do
|
2012-09-17 12:39:57 -04:00
|
|
|
visit project_tree_path(project, @branch_name)
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
within(".tree_commit") do
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-01-15 12:18:52 -05:00
|
|
|
# @wip
|
|
|
|
#it "should render title in refs#blame" do
|
|
|
|
#visit project_blame_path(project, File.join(@branch_name, @test_file))
|
|
|
|
|
|
|
|
#within(".blame_commit") do
|
|
|
|
#page.should have_link("##{issue.id}")
|
|
|
|
#end
|
|
|
|
#end
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
it "should render title in repositories#branches" do
|
|
|
|
visit branches_project_repository_path(project)
|
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "for issues" do
|
|
|
|
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,
|
|
|
|
title: "fix ##{@other_issue.id}",
|
2012-12-06 22:40:42 -05:00
|
|
|
description: "ask @#{fred.username} for details")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should render subject in issues#index" do
|
|
|
|
visit project_issues_path(project)
|
|
|
|
|
|
|
|
page.should have_link("##{@other_issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render subject in issues#show" do
|
|
|
|
visit project_issue_path(project, @issue)
|
|
|
|
|
|
|
|
page.should have_link("##{@other_issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render details in issues#show" do
|
|
|
|
visit project_issue_path(project, @issue)
|
|
|
|
|
2012-12-06 22:40:42 -05:00
|
|
|
page.should have_link("@#{fred.username}")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
describe "for merge requests" do
|
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@merge_request = create(:merge_request,
|
|
|
|
project: project,
|
|
|
|
title: "fix ##{issue.id}")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should render title in merge_requests#index" do
|
|
|
|
visit project_merge_requests_path(project)
|
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render title in merge_requests#show" do
|
|
|
|
visit project_merge_request_path(project, @merge_request)
|
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
describe "for milestones" do
|
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@milestone = create(:milestone,
|
|
|
|
project: project,
|
|
|
|
title: "fix ##{issue.id}",
|
2012-12-06 22:40:42 -05:00
|
|
|
description: "ask @#{fred.username} for details")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should render title in milestones#index" do
|
|
|
|
visit project_milestones_path(project)
|
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render title in milestones#show" do
|
|
|
|
visit project_milestone_path(project, @milestone)
|
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should render description in milestones#show" do
|
|
|
|
visit project_milestone_path(project, @milestone)
|
|
|
|
|
2012-12-06 22:40:42 -05:00
|
|
|
page.should have_link("@#{fred.username}")
|
2012-08-01 20:30:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
describe "for notes" do
|
2012-08-10 18:07:50 -04:00
|
|
|
it "should render in commits#show", js: true do
|
2012-09-17 10:06:56 -04:00
|
|
|
visit project_commit_path(project, commit)
|
2013-02-21 06:09:47 -05:00
|
|
|
within ".new_note.js-main-target-form" do
|
|
|
|
fill_in "note_note", with: "see ##{issue.id}"
|
|
|
|
click_button "Add Comment"
|
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
2012-08-10 18:07:50 -04:00
|
|
|
it "should render in issue#show", js: true do
|
2012-08-01 20:30:36 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2013-02-21 06:09:47 -05:00
|
|
|
within ".new_note.js-main-target-form" do
|
|
|
|
fill_in "note_note", with: "see ##{issue.id}"
|
|
|
|
click_button "Add Comment"
|
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
|
2012-08-10 18:07:50 -04:00
|
|
|
it "should render in merge_request#show", js: true do
|
2012-08-01 20:30:36 -04:00
|
|
|
visit project_merge_request_path(project, merge_request)
|
2013-02-21 06:09:47 -05:00
|
|
|
within ".new_note.js-main-target-form" do
|
|
|
|
fill_in "note_note", with: "see ##{issue.id}"
|
|
|
|
click_button "Add Comment"
|
|
|
|
end
|
2012-08-01 20:30:36 -04:00
|
|
|
|
|
|
|
page.should have_link("##{issue.id}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|