gitlab-org--gitlab-foss/spec/features/gitlab_flavored_markdown_spec.rb

132 lines
3.4 KiB
Ruby
Raw Normal View History

require 'spec_helper'
describe "Gitlab Flavored Markdown" do
let(:project) { create(:project_with_code) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, project: project) }
let(:fred) do
u = create(:user, name: "fred")
2013-01-04 11:50:31 -05:00
project.team << [u, :master]
u
end
before do
2013-04-10 13:00:56 -04:00
Commit.any_instance.stub(title: "fix ##{issue.id}\n\nask @#{fred.username} for details")
end
2012-09-14 18:00:59 -04:00
2013-04-10 13:00:56 -04:00
let(:commit) { project.repository.commit }
before do
login_as :user
2013-01-04 11:50:31 -05:00
project.team << [@user, :developer]
end
describe "for commits" do
it "should render title in commits#index" do
2013-04-10 13:00:56 -04:00
visit project_commits_path(project, 'master', limit: 1)
page.should have_link("##{issue.id}")
end
it "should render title in commits#show" do
visit project_commit_path(project, commit)
page.should have_link("##{issue.id}")
end
it "should render description in commits#show" do
visit project_commit_path(project, commit)
page.should have_link("@#{fred.username}")
end
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
@other_issue = create(:issue,
author: @user,
assignee: @user,
project: project)
@issue = create(:issue,
author: @user,
assignee: @user,
project: project,
title: "fix ##{@other_issue.id}",
description: "ask @#{fred.username} for details")
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)
page.should have_link("@#{fred.username}")
end
end
describe "for merge requests" do
before do
@merge_request = create(:merge_request,
project: project,
title: "fix ##{issue.id}")
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
@milestone = create(:milestone,
project: project,
title: "fix ##{issue.id}",
description: "ask @#{fred.username} for details")
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)
page.should have_link("@#{fred.username}")
end
end
end