Merge pull request #2208 from jouve/username2
Allow proper use of @username in Git(lab|hub) Flavored Markdown.
This commit is contained in:
commit
85db534afc
3 changed files with 34 additions and 37 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue