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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

140 lines
3.8 KiB
Ruby
Raw Permalink Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe "GitLab Flavored Markdown", feature_category: :team_planning do
2017-09-10 17:25:29 +05:30
let(:user) { create(:user) }
let(:project) { create(:project) }
2014-09-02 18:07:02 +05:30
let(:issue) { create(:issue, project: project) }
let(:fred) do
2017-08-17 22:00:37 +05:30
create(:user, name: 'fred') do |user|
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-08-17 22:00:37 +05:30
end
2014-09-02 18:07:02 +05:30
end
before do
2017-09-10 17:25:29 +05:30
sign_in(user)
project.add_developer(user)
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
describe "for commits" do
let(:project) { create(:project, :repository) }
let(:commit) { project.commit }
2014-09-02 18:07:02 +05:30
2017-08-17 22:00:37 +05:30
before do
2022-11-25 23:54:43 +05:30
project.repository.commit_files(
user,
branch_name: 'master',
message: "fix #{issue.to_reference}\n\nask #{fred.to_reference} for details",
actions: [{ action: :create, file_path: 'a/new.file', content: 'This is a file' }]
)
2017-08-17 22:00:37 +05:30
end
2014-09-02 18:07:02 +05:30
2016-09-13 17:45:13 +05:30
it "renders title in commits#index" do
2017-09-10 17:25:29 +05:30
visit project_commits_path(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
2016-09-13 17:45:13 +05:30
it "renders title in commits#show" do
2017-09-10 17:25:29 +05:30
visit project_commit_path(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
2016-09-13 17:45:13 +05:30
it "renders description in commits#show" do
2017-09-10 17:25:29 +05:30
visit project_commit_path(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
2016-09-13 17:45:13 +05:30
it "renders title in repositories#branches" do
2017-09-10 17:25:29 +05:30
visit project_branches_path(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
2018-03-17 18:26:18 +05:30
describe "for issues", :js do
2014-09-02 18:07:02 +05:30
before do
@other_issue = create(:issue,
2017-09-10 17:25:29 +05:30
author: user,
assignees: [user],
2014-09-02 18:07:02 +05:30
project: project)
@issue = create(:issue,
2017-09-10 17:25:29 +05:30
author: user,
assignees: [user],
2014-09-02 18:07:02 +05:30
project: project,
2015-09-11 14:41:01 +05:30
title: "fix #{@other_issue.to_reference}",
description: "ask #{fred.to_reference} for details")
2017-08-17 22:00:37 +05:30
@note = create(:note_on_issue, noteable: @issue, project: @issue.project, note: "Hello world")
2014-09-02 18:07:02 +05:30
end
2016-09-13 17:45:13 +05:30
it "renders subject in issues#index" do
2017-09-10 17:25:29 +05:30
visit project_issues_path(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
2016-09-13 17:45:13 +05:30
it "renders subject in issues#show" do
2017-09-10 17:25:29 +05:30
visit project_issue_path(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
2016-09-13 17:45:13 +05:30
it "renders details in issues#show" do
2017-09-10 17:25:29 +05:30
visit project_issue_path(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
2017-08-17 22:00:37 +05:30
let(:project) { create(:project, :repository) }
2014-09-02 18:07:02 +05:30
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
2016-09-13 17:45:13 +05:30
it "renders title in merge_requests#index" do
2017-09-10 17:25:29 +05:30
visit project_merge_requests_path(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
2016-09-13 17:45:13 +05:30
it "renders title in merge_requests#show" do
2017-09-10 17:25:29 +05:30
visit project_merge_request_path(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
2016-09-13 17:45:13 +05:30
it "renders title in milestones#index" do
2017-09-10 17:25:29 +05:30
visit project_milestones_path(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
2016-09-13 17:45:13 +05:30
it "renders title in milestones#show" do
2017-09-10 17:25:29 +05:30
visit project_milestone_path(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
2016-09-13 17:45:13 +05:30
it "renders description in milestones#show" do
2017-09-10 17:25:29 +05:30
visit project_milestone_path(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