Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAriejan de Vroom <ariejan@ariejan.net>2012-12-07 13:30:36 +0400
committerAriejan de Vroom <ariejan@ariejan.net>2012-12-07 13:30:36 +0400
commit85db534afc442a23c81f319d65c49f274ce6ab4b (patch)
tree00c32f33dcb3e3e7e7f502110232eb7eb4ac0d17 /spec
parent945fe846a14dd1e1dc3a5b23c097224dbe471e50 (diff)
parent045b4c8fcd3898bf66ac74acdf13cc079a104105 (diff)
Merge pull request #2208 from jouve/username2
Allow proper use of @username in Git(lab|hub) Flavored Markdown.
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb16
-rw-r--r--spec/requests/gitlab_flavored_markdown_spec.rb12
2 files changed, 14 insertions, 14 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index 05e4527b278..1eafc6663a2 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -3,7 +3,7 @@ require "spec_helper"
describe GitlabMarkdownHelper do
let!(:project) { create(:project) }
- let(:user) { create(:user, name: 'gfm') }
+ let(:user) { create(:user, username: 'gfm') }
let(:commit) { CommitDecorator.decorate(project.commit) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, project: project) }
@@ -81,7 +81,7 @@ describe GitlabMarkdownHelper do
end
describe "referencing a team member" do
- let(:actual) { "@#{user.name} you are right." }
+ let(:actual) { "@#{user.username} you are right." }
let(:expected) { project_team_member_path(project, member) }
before do
@@ -103,18 +103,18 @@ describe GitlabMarkdownHelper do
end
it "should link with adjacent text" do
- actual = "Mail the admin (@gfm)"
+ actual = "Mail the admin (@#{user.username})"
gfm(actual).should match(expected)
end
it "should keep whitespace intact" do
- actual = "Yes, @#{user.name} is right."
- expected = /Yes, <a.+>@#{user.name}<\/a> is right/
+ actual = "Yes, @#{user.username} is right."
+ expected = /Yes, <a.+>@#{user.username}<\/a> is right/
gfm(actual).should match(expected)
end
it "should not link with an invalid id" do
- actual = expected = "@#{user.name.reverse} you are right."
+ actual = expected = "@#{user.username.reverse} you are right."
gfm(actual).should == expected
end
@@ -316,10 +316,10 @@ describe GitlabMarkdownHelper do
it "should handle references in lists" do
project.users << user
- actual = "\n* dark: ##{issue.id}\n* light by @#{member.user_name}"
+ actual = "\n* dark: ##{issue.id}\n* light by @#{member.user.username}"
markdown(actual).should match(%r{<li>dark: <a.+>##{issue.id}</a></li>})
- markdown(actual).should match(%r{<li>light by <a.+>@#{member.user_name}</a></li>})
+ markdown(actual).should match(%r{<li>light by <a.+>@#{member.user.username}</a></li>})
end
it "should handle references in <em>" do
diff --git a/spec/requests/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb
index ad5d7cd7607..98319f81657 100644
--- a/spec/requests/gitlab_flavored_markdown_spec.rb
+++ b/spec/requests/gitlab_flavored_markdown_spec.rb
@@ -19,7 +19,7 @@ describe "Gitlab Flavored Markdown" do
@test_file = "gfm_test_file"
i.add(@test_file, "foo\nbar\n")
# add commit with gfm
- i.commit("fix ##{issue.id}\n\nask @#{fred.name} for details", head: @branch_name)
+ i.commit("fix ##{issue.id}\n\nask @#{fred.username} for details", head: @branch_name)
# add test tag
@tag_name = "gfm-test-tag"
@@ -56,7 +56,7 @@ describe "Gitlab Flavored Markdown" do
it "should render description in commits#show" do
visit project_commit_path(project, commit)
- page.should have_link("@#{fred.name}")
+ page.should have_link("@#{fred.username}")
end
it "should render title in refs#tree", js: true do
@@ -93,7 +93,7 @@ describe "Gitlab Flavored Markdown" do
assignee: @user,
project: project,
title: "fix ##{@other_issue.id}",
- description: "ask @#{fred.name} for details")
+ description: "ask @#{fred.username} for details")
end
it "should render subject in issues#index" do
@@ -111,7 +111,7 @@ describe "Gitlab Flavored Markdown" do
it "should render details in issues#show" do
visit project_issue_path(project, @issue)
- page.should have_link("@#{fred.name}")
+ page.should have_link("@#{fred.username}")
end
end
@@ -142,7 +142,7 @@ describe "Gitlab Flavored Markdown" do
@milestone = create(:milestone,
project: project,
title: "fix ##{issue.id}",
- description: "ask @#{fred.name} for details")
+ description: "ask @#{fred.username} for details")
end
it "should render title in milestones#index" do
@@ -160,7 +160,7 @@ describe "Gitlab Flavored Markdown" do
it "should render description in milestones#show" do
visit project_milestone_path(project, @milestone)
- page.should have_link("@#{fred.name}")
+ page.should have_link("@#{fred.username}")
end
end