diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-08-27 13:09:01 -0700 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-08-27 14:17:26 -0700 |
commit | 4340dd3eeb6fdda83b729c16cba29239b8ed9f43 (patch) | |
tree | f583b7a81cfbd47a7ec393397d17e37dee759539 /spec | |
parent | 10ee826847f956a235952fbb41d5ba589927b862 (diff) | |
download | gitlab-ce-4340dd3eeb6fdda83b729c16cba29239b8ed9f43.tar.gz |
Decouple Gitlab::Markdown from the GitlabMarkdownHelper
This module is now the sole source of knowledge for *how* we render
Markdown (and GFM).
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/markdown_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 22 |
2 files changed, 7 insertions, 17 deletions
diff --git a/spec/features/markdown_spec.rb b/spec/features/markdown_spec.rb index 4fe019f8342..c557a1061af 100644 --- a/spec/features/markdown_spec.rb +++ b/spec/features/markdown_spec.rb @@ -179,7 +179,7 @@ describe 'GitLab Markdown', feature: true do before(:all) do @feat = MarkdownFeature.new - # `gfm` helper depends on a `@project` variable + # `markdown` helper expects a `@project` variable @project = @feat.project @html = markdown(@feat.raw_markdown) diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index a42ccb9b501..d1ca2337a9b 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -19,10 +19,10 @@ describe GitlabMarkdownHelper do @project = project end - describe "#gfm" do + describe "#markdown" do it "should forward HTML options to links" do - expect(gfm("Fixed in #{commit.id}", { project: @project }, class: 'foo')). - to have_selector('a.gfm.foo') + expect(markdown("Fixed in #{commit.id}", project: @project)). + to have_selector('a.gfm') end describe "referencing multiple objects" do @@ -30,17 +30,17 @@ describe GitlabMarkdownHelper do it "should link to the merge request" do expected = namespace_project_merge_request_path(project.namespace, project, merge_request) - expect(gfm(actual)).to match(expected) + expect(markdown(actual)).to match(expected) end it "should link to the commit" do expected = namespace_project_commit_path(project.namespace, project, commit) - expect(gfm(actual)).to match(expected) + expect(markdown(actual)).to match(expected) end it "should link to the issue" do expected = namespace_project_issue_path(project.namespace, project, issue) - expect(gfm(actual)).to match(expected) + expect(markdown(actual)).to match(expected) end end end @@ -79,16 +79,6 @@ describe GitlabMarkdownHelper do expect(doc.css('a')[4].text).to eq ' for real' end - it 'should forward HTML options' do - actual = link_to_gfm("Fixed in #{commit.id}", commit_path, class: 'foo') - doc = Nokogiri::HTML.parse(actual) - - expect(doc.css('a')).to satisfy do |v| - # 'foo' gets added to all links - v.all? { |a| a.attr('class').match(/foo$/) } - end - end - it "escapes HTML passed in as the body" do actual = "This is a <h1>test</h1> - see #{issues[0].to_reference}" expect(link_to_gfm(actual, commit_path)). |