debian-mirror-gitlab/spec/features/gitlab_flavored_markdown_spec.rb

129 lines
3.9 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require 'spec_helper'
describe "GitLab Flavored Markdown", feature: true do
let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:fred) do
u = create(:user, name: "fred")
project.team << [u, :master]
u
end
before do
2015-09-11 14:41:01 +05:30
allow_any_instance_of(Commit).to receive(:title).
and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
let(:commit) { project.commit }
2014-09-02 18:07:02 +05:30
before do
login_as :user
project.team << [@user, :developer]
end
describe "for commits" do
it "should render title in commits#index" do
2015-04-26 12:48:37 +05:30
visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render title in commits#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_commit_path(project.namespace, project, commit)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render description in commits#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_commit_path(project.namespace, project, commit)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(fred.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render title in repositories#branches" do
2015-04-26 12:48:37 +05:30
visit namespace_project_branches_path(project.namespace, project)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
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,
2015-09-11 14:41:01 +05:30
title: "fix #{@other_issue.to_reference}",
description: "ask #{fred.to_reference} for details")
2014-09-02 18:07:02 +05:30
end
it "should render subject in issues#index" do
2015-04-26 12:48:37 +05:30
visit namespace_project_issues_path(project.namespace, project)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(@other_issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render subject in issues#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_issue_path(project.namespace, project, @issue)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(@other_issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render details in issues#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_issue_path(project.namespace, project, @issue)
2014-09-02 18:07:02 +05:30
2015-09-25 12:07:36 +05:30
expect(page).to have_link(fred.to_reference)
2014-09-02 18:07:02 +05:30
end
end
describe "for merge requests" do
before do
2015-09-11 14:41:01 +05:30
@merge_request = create(:merge_request, source_project: project, target_project: project, title: "fix #{issue.to_reference}")
2014-09-02 18:07:02 +05:30
end
it "should render title in merge_requests#index" do
2015-04-26 12:48:37 +05:30
visit namespace_project_merge_requests_path(project.namespace, project)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render title in merge_requests#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_merge_request_path(project.namespace, project, @merge_request)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
end
end
describe "for milestones" do
before do
@milestone = create(:milestone,
project: project,
2015-09-11 14:41:01 +05:30
title: "fix #{issue.to_reference}",
description: "ask #{fred.to_reference} for details")
2014-09-02 18:07:02 +05:30
end
it "should render title in milestones#index" do
2015-04-26 12:48:37 +05:30
visit namespace_project_milestones_path(project.namespace, project)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render title in milestones#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_milestone_path(project.namespace, project, @milestone)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(issue.to_reference)
2014-09-02 18:07:02 +05:30
end
it "should render description in milestones#show" do
2015-04-26 12:48:37 +05:30
visit namespace_project_milestone_path(project.namespace, project, @milestone)
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
expect(page).to have_link(fred.to_reference)
2014-09-02 18:07:02 +05:30
end
end
end