Commit 281643a1bfd6f4da88a278bfce20133c80105de5
1 parent
603e04bc
Exists in
spb-stable
and in
2 other branches
Add feature spec.
Showing
3 changed files
with
21 additions
and
3 deletions
Show diff stats
features/project/issues/issues.feature
... | ... | @@ -68,6 +68,12 @@ Feature: Project Issues |
68 | 68 | And I leave a comment with a header containing "Comment with a header" |
69 | 69 | Then The comment with the header should not have an ID |
70 | 70 | |
71 | + @javascript | |
72 | + Scenario: Blocks inside comments should not build relative links | |
73 | + Given I visit issue page "Release 0.4" | |
74 | + And I leave a comment with code block | |
75 | + Then The code block should be unchanged | |
76 | + | |
71 | 77 | Scenario: Issues on empty project |
72 | 78 | Given empty project "Empty Project" |
73 | 79 | When I visit empty project page | ... | ... |
features/steps/project/issues.rb
... | ... | @@ -163,4 +163,16 @@ class ProjectIssues < Spinach::FeatureSteps |
163 | 163 | project = Project.find_by(name: 'Empty Project') |
164 | 164 | visit project_issues_path(project) |
165 | 165 | end |
166 | + | |
167 | + step 'I leave a comment with code block' do | |
168 | + within(".js-main-target-form") do | |
169 | + fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" | |
170 | + click_button "Add Comment" | |
171 | + sleep 0.05 | |
172 | + end | |
173 | + end | |
174 | + | |
175 | + step 'The code block should be unchanged' do | |
176 | + page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```") | |
177 | + end | |
166 | 178 | end | ... | ... |
lib/redcarpet/render/gitlab_html.rb
... | ... | @@ -6,8 +6,6 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML |
6 | 6 | def initialize(template, options = {}) |
7 | 7 | @template = template |
8 | 8 | @project = @template.instance_variable_get("@project") |
9 | - @ref = @template.instance_variable_get("@ref") | |
10 | - @request_path = @template.instance_variable_get("@path") | |
11 | 9 | @options = options.dup |
12 | 10 | super options |
13 | 11 | end |
... | ... | @@ -46,7 +44,9 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML |
46 | 44 | end |
47 | 45 | |
48 | 46 | def postprocess(full_document) |
49 | - full_document = h.create_relative_links(full_document) | |
47 | + unless @template.instance_variable_get("@project_wiki") || @project.nil? | |
48 | + full_document = h.create_relative_links(full_document) | |
49 | + end | |
50 | 50 | h.gfm(full_document) |
51 | 51 | end |
52 | 52 | end | ... | ... |