gfm("@#{user.name} you are right").should=="#{link_to"@#{user.name}",project_team_member_path(@project,member),class: "gfm gfm-team_member "} you are right"
gfm("@#{user.name} you are right").should=="#{link_to"@#{user.name}",project_team_member_path(@project,member),class: "gfm gfm-team_member "} you are right"
gfm("@#{user.name} you are right").should=="#{link_to"@#{user.name}",project_team_member_path(@project,member),class: "gfm gfm-team_member "} you are right"
gfm("Mail the Admin (@#{user.name})").should=="Mail the Admin (#{link_to"@#{user.name}",project_team_member_path(@project,member),class: "gfm gfm-team_member "})"
end
it"should add styles"do
user=Factory:user,name: "barry"
@project.users<<user
gfm("@#{user.name} you are right").shouldhave_selector(".gfm.gfm-team_member")
end
it"should not link using a bogus name"do
gfm("What hapened to @foo?").should=="What hapened to @foo?"
gfm("This has already been discussed (see ##{@issue.id})").should=="This has already been discussed (see #{link_to"##{@issue.id}",project_issue_path(@project,@issue),title: "Issue: #{@issue.title}",class: "gfm gfm-issue "})"
gfm("Fixed in !#{@merge_request.id}").should=="Fixed in #{link_to"!#{@merge_request.id}",project_merge_request_path(@project,@merge_request),title: "Merge Request: #{@merge_request.title}",class: "gfm gfm-merge_request "}"
end
it"should link with adjecent text"do
gfm("This has been fixed already (see !#{@merge_request.id})").should=="This has been fixed already (see #{link_to"!#{@merge_request.id}",project_merge_request_path(@project,@merge_request),title: "Merge Request: #{@merge_request.title}",class: "gfm gfm-merge_request "})"
end
it"should add styles"do
gfm("Fixed in !#{@merge_request.id}").shouldhave_selector(".gfm.gfm-merge_request")
gfm("Check out $#{@snippet.id}").should=="Check out #{link_to"$#{@snippet.id}",project_snippet_path(@project,@snippet),title: "Snippet: #{@snippet.title}",class: "gfm gfm-snippet "}"
end
it"should link with adjecent text"do
gfm("I have created a snippet for that ($#{@snippet.id})").should=="I have created a snippet for that (#{link_to"$#{@snippet.id}",project_snippet_path(@project,@snippet),title: "Snippet: #{@snippet.title}",class: "gfm gfm-snippet "})"
end
it"should add styles"do
gfm("Check out $#{@snippet.id}").shouldhave_selector(".gfm.gfm-snippet")
markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{@commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should=="<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_to@commit.id,project_commit_path(@project,id: @commit.id),title: "Commit: #{@commit.author_name} - #{@commit.title}",class: "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.</p>\n"
end
it"should handle references in headers"do
markdown("\n# Working around ##{@issue.id} for now\n## Apply !#{@merge_request.id}").should=="<h1 id=\"toc_0\">Working around #{link_to"##{@issue.id}",project_issue_path(@project,@issue),title: "Issue: #{@issue.title}",class: "gfm gfm-issue "} for now</h1>\n\n<h2 id=\"toc_1\">Apply #{link_to"!#{@merge_request.id}",project_merge_request_path(@project,@merge_request),title: "Merge Request: #{@merge_request.title}",class: "gfm gfm-merge_request "}</h2>\n"
end
it"should handle references in lists"do
markdown("\n* dark: ##{@issue.id}\n* light by @#{@other_user.name}\n").should=="<ul>\n<li>dark: #{link_to"##{@issue.id}",project_issue_path(@project,@issue),title: "Issue: #{@issue.title}",class: "gfm gfm-issue "}</li>\n<li>light by #{link_to"@#{@other_user.name}",project_team_member_path(@project,@member),class: "gfm gfm-team_member "}</li>\n</ul>\n"
actual=link_to_gfm("Fixed in #{commit.id}",commit_path,class: 'foo')
actual.shouldhave_selector'a.gfm.gfm-commit.foo'
end
end
describe"#markdown"do
it"should handle references in paragraphs"do
markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should=="<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_tocommit.id,project_commit_path(project,commit),title: commit.link_title,class: "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.</p>\n"
end
it"should handle references in headers"do
actual="\n# Working around ##{issue.id}\n## Apply !#{merge_request.id}"
markdown(actual).shouldmatch(%r{<h1[^<]*>Working around <a.+>##{issue.id}</a></h1>})