1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

cleanup: rubocop: fix Layout/ClosingHeredocIndentation and Layout/IndentHeredoc in test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@19020 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2019-11-09 14:11:02 +00:00
parent b18ba29c87
commit bbef1d6c0f
2 changed files with 31 additions and 35 deletions

View File

@ -36,7 +36,6 @@ Layout/CaseIndentation:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Layout/ClosingHeredocIndentation: Layout/ClosingHeredocIndentation:
Exclude: Exclude:
- 'test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb'
- 'test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb' - 'test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb'
- 'test/unit/lib/redmine/wiki_formatting_test.rb' - 'test/unit/lib/redmine/wiki_formatting_test.rb'
@ -151,7 +150,6 @@ Layout/IndentFirstHashElement:
# SupportedStyles: squiggly, active_support, powerpack, unindent # SupportedStyles: squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc: Layout/IndentHeredoc:
Exclude: Exclude:
- 'test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb'
- 'test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb' - 'test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb'
- 'test/unit/lib/redmine/wiki_formatting_test.rb' - 'test/unit/lib/redmine/wiki_formatting_test.rb'

View File

@ -61,23 +61,23 @@ class Redmine::WikiFormatting::MarkdownFormatterTest < ActionView::TestCase
end end
def test_should_support_syntax_highlight def test_should_support_syntax_highlight
text = <<-STR text = <<~STR
~~~ruby ~~~ruby
def foo def foo
end end
~~~ ~~~
STR STR
assert_select_in @formatter.new(text).to_html, 'pre code.ruby.syntaxhl' do assert_select_in @formatter.new(text).to_html, 'pre code.ruby.syntaxhl' do
assert_select 'span.k', :text => 'def' assert_select 'span.k', :text => 'def'
end end
end end
def test_should_not_allow_invalid_language_for_code_blocks def test_should_not_allow_invalid_language_for_code_blocks
text = <<-STR text = <<~STR
~~~foo ~~~foo
test test
~~~ ~~~
STR STR
assert_equal "<pre>test\n</pre>", @formatter.new(text).to_html assert_equal "<pre>test\n</pre>", @formatter.new(text).to_html
end end
@ -92,35 +92,33 @@ STR
end end
def test_markdown_should_not_require_surrounded_empty_line def test_markdown_should_not_require_surrounded_empty_line
text = <<-STR text = <<~STR
This is a list: This is a list:
* One * One
* Two * Two
STR STR
assert_equal "<p>This is a list:</p>\n\n<ul>\n<li>One</li>\n<li>Two</li>\n</ul>", @formatter.new(text).to_html.strip assert_equal "<p>This is a list:</p>\n\n<ul>\n<li>One</li>\n<li>Two</li>\n</ul>", @formatter.new(text).to_html.strip
end end
def test_footnotes def test_footnotes
text = <<-STR text = <<~STR
This is some text[^1]. This is some text[^1].
[^1]: This is the foot note [^1]: This is the foot note
STR STR
expected = <<~EXPECTED
<p>This is some text<sup id="fnref1"><a href="#fn1">1</a></sup>.</p>
<div class="footnotes">
<hr>
<ol>
expected = <<-EXPECTED <li id="fn1">
<p>This is some text<sup id="fnref1"><a href="#fn1">1</a></sup>.</p> <p>This is the foot note&nbsp;<a href="#fnref1">&#8617;</a></p>
<div class="footnotes"> </li>
<hr>
<ol>
<li id="fn1">
<p>This is the foot note&nbsp;<a href="#fnref1">&#8617;</a></p>
</li>
</ol>
</div>
EXPECTED
</ol>
</div>
EXPECTED
assert_equal expected.gsub(%r{[\r\n\t]}, ''), @formatter.new(text).to_html.gsub(%r{[\r\n\t]}, '') assert_equal expected.gsub(%r{[\r\n\t]}, ''), @formatter.new(text).to_html.gsub(%r{[\r\n\t]}, '')
end end