From 43b245acdc3db14eabbe907c67796712d2769adb Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Thu, 10 Dec 2020 13:34:31 +0000 Subject: [PATCH] shorten long line of ApplicationHelperTest git-svn-id: http://svn.redmine.org/redmine/trunk@20613 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/helpers/application_helper_test.rb | 105 ++++++++++++++++-------- 1 file changed, 71 insertions(+), 34 deletions(-) diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 8a7fe3e37..24761e126 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -74,16 +74,23 @@ class ApplicationHelperTest < Redmine::HelperTest 'https://foo.bar.' => 'https://foo.bar.', 'This is a link: http://foo.bar.' => 'This is a link: http://foo.bar.', 'A link (eg. http://foo.bar).' => 'A link (eg. http://foo.bar).', - 'http://foo.bar/foo.bar#foo.bar.' => 'http://foo.bar/foo.bar#foo.bar.', - 'http://www.foo.bar/Test_(foobar)' => 'http://www.foo.bar/Test_(foobar)', - '(see inline link : http://www.foo.bar/Test_(foobar))' => '(see inline link : http://www.foo.bar/Test_(foobar))', - '(see inline link : http://www.foo.bar/Test)' => '(see inline link : http://www.foo.bar/Test)', - '(see inline link : http://www.foo.bar/Test).' => '(see inline link : http://www.foo.bar/Test).', - '(see "inline link":http://www.foo.bar/Test_(foobar))' => '(see inline link)', + 'http://foo.bar/foo.bar#foo.bar.' => + 'http://foo.bar/foo.bar#foo.bar.', + 'http://www.foo.bar/Test_(foobar)' => + 'http://www.foo.bar/Test_(foobar)', + '(see inline link : http://www.foo.bar/Test_(foobar))' => + '(see inline link : http://www.foo.bar/Test_(foobar))', + '(see inline link : http://www.foo.bar/Test)' => + '(see inline link : http://www.foo.bar/Test)', + '(see inline link : http://www.foo.bar/Test).' => + '(see inline link : http://www.foo.bar/Test).', + '(see "inline link":http://www.foo.bar/Test_(foobar))' => + '(see inline link)', '(see "inline link":http://www.foo.bar/Test)' => '(see inline link)', '(see "inline link":http://www.foo.bar/Test).' => '(see inline link).', 'www.foo.bar' => 'www.foo.bar', - 'http://foo.bar/page?p=1&t=z&s=' => 'http://foo.bar/page?p=1&t=z&s=', + 'http://foo.bar/page?p=1&t=z&s=' => + 'http://foo.bar/page?p=1&t=z&s=', 'http://foo.bar/page#125' => 'http://foo.bar/page#125', 'http://foo@www.bar.com' => 'http://foo@www.bar.com', 'http://foo:bar@www.bar.com' => 'http://foo:bar@www.bar.com', @@ -91,7 +98,9 @@ class ApplicationHelperTest < Redmine::HelperTest 'ftps://foo.bar' => 'ftps://foo.bar', 'sftp://foo.bar' => 'sftp://foo.bar', # two exclamation marks - 'http://example.net/path!602815048C7B5C20!302.html' => 'http://example.net/path!602815048C7B5C20!302.html', + 'http://example.net/path!602815048C7B5C20!302.html' => + '' \ + 'http://example.net/path!602815048C7B5C20!302.html', # escaping 'http://foo"bar' => 'http://foo"bar', # wrap in angle brackets @@ -101,7 +110,8 @@ class ApplicationHelperTest < Redmine::HelperTest 'www.' => 'www.', 'test-www.bar.com' => 'test-www.bar.com', # ends with a hyphen - 'http://www.redmine.org/example-' => 'http://www.redmine.org/example-', + 'http://www.redmine.org/example-' => + 'http://www.redmine.org/example-', } to_test.each {|text, result| assert_equal "

#{result}

", textilizable(text)} end @@ -125,12 +135,19 @@ class ApplicationHelperTest < Redmine::HelperTest def test_inline_images to_test = { '!http://foo.bar/image.jpg!' => '', - 'floating !>http://foo.bar/image.jpg!' => 'floating ', - 'with class !(some-class)http://foo.bar/image.jpg!' => 'with class ', - 'with class !(wiki-class-foo)http://foo.bar/image.jpg!' => 'with class ', - 'with style !{width:100px;height:100px}http://foo.bar/image.jpg!' => 'with style ', - 'with title !http://foo.bar/image.jpg(This is a title)!' => 'with title This is a title', - 'with title !http://foo.bar/image.jpg(This is a double-quoted "title")!' => 'with title This is a double-quoted "title"', + 'floating !>http://foo.bar/image.jpg!' => + 'floating ', + 'with class !(some-class)http://foo.bar/image.jpg!' => + 'with class ', + 'with class !(wiki-class-foo)http://foo.bar/image.jpg!' => + 'with class ', + 'with style !{width:100px;height:100px}http://foo.bar/image.jpg!' => + 'with style ', + 'with title !http://foo.bar/image.jpg(This is a title)!' => + 'with title This is a title', + 'with title !http://foo.bar/image.jpg(This is a double-quoted "title")!' => + 'with title ', } to_test.each {|text, result| assert_equal "

#{result}

", textilizable(text)} end @@ -149,12 +166,15 @@ class ApplicationHelperTest < Redmine::HelperTest def test_attached_images to_test = { - 'Inline image: !logo.gif!' => 'Inline image: This is a logo', - 'Inline image: !logo.GIF!' => 'Inline image: This is a logo', + 'Inline image: !logo.gif!' => + 'Inline image: This is a logo', + 'Inline image: !logo.GIF!' => + 'Inline image: This is a logo', 'No match: !ogo.gif!' => 'No match: ', 'No match: !ogo.GIF!' => 'No match: ', # link image - '!logo.gif!:http://foo.bar/' => 'This is a logo', + '!logo.gif!:http://foo.bar/' => + 'This is a logo', } attachments = Attachment.all to_test.each {|text, result| assert_equal "

#{result}

", textilizable(text, :attachments => attachments)} @@ -168,7 +188,8 @@ class ApplicationHelperTest < Redmine::HelperTest with_settings :text_formatting => 'textile' do to_test.each do |filename, result| attachment = Attachment.generate!(:filename => filename) - assert_include %(), textilizable("!#{filename}!", :attachments => [attachment]) + assert_include %(), + textilizable("!#{filename}!", :attachments => [attachment]) end end end @@ -183,7 +204,8 @@ class ApplicationHelperTest < Redmine::HelperTest with_settings :text_formatting => 'markdown' do to_test.each do |filename, result| attachment = Attachment.generate!(:filename => filename) - assert_include %(), textilizable("![](#{filename})", :attachments => [attachment]) + assert_include %(), + textilizable("![](#{filename})", :attachments => [attachment]) end end end @@ -191,7 +213,8 @@ class ApplicationHelperTest < Redmine::HelperTest def test_attached_images_with_hires_naming attachment = Attachment.generate!(:filename => 'image@2x.png') assert_equal( - %(

), + %(

), textilizable("!image@2x.png!", :attachments => [attachment]) ) end @@ -287,19 +310,25 @@ class ApplicationHelperTest < Redmine::HelperTest 'This is a "link":http://foo.bar' => 'This is a link', 'This is an intern "link":/foo/bar' => 'This is an intern link', '"link (Link title)":http://foo.bar' => 'link', - '"link (Link title with "double-quotes")":http://foo.bar' => 'link', + '"link (Link title with "double-quotes")":http://foo.bar' => + 'link', "This is not a \"Link\":\n\nAnother paragraph" => "This is not a \"Link\":

\n\n\n\t

Another paragraph", # no multiline link text - "This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line
and another on a second line\":test", + "This is a double quote \"on the first line\nand another on a second line\":test" => + "This is a double quote \"on the first line
and another on a second line\":test", # mailto link - "\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => "system administrator", + "\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => + "system administrator", # two exclamation marks - '"a link":http://example.net/path!602815048C7B5C20!302.html' => 'a link', + '"a link":http://example.net/path!602815048C7B5C20!302.html' => + 'a link', # escaping '"test":http://foo"bar' => 'test', # ends with a hyphen - '(see "inline link":http://www.foo.bar/Test-)' => '(see inline link)', - 'http://foo.bar/page?p=1&t=z&s=-' => 'http://foo.bar/page?p=1&t=z&s=-', + '(see "inline link":http://www.foo.bar/Test-)' => + '(see inline link)', + 'http://foo.bar/page?p=1&t=z&s=-' => + 'http://foo.bar/page?p=1&t=z&s=-', 'This is an intern "link":/foo/bar-' => 'This is an intern link' } to_test.each {|text, result| assert_equal "

#{result}

", textilizable(text)} @@ -1747,7 +1776,8 @@ class ApplicationHelperTest < Redmine::HelperTest [projects(:projects_001), 'eCookbook'], [users(:users_001), 'Redmine Admin'], [versions(:versions_001), 'eCookbook - 0.1'], - [wiki_pages(:wiki_pages_001), 'CookBook documentation'] + [wiki_pages(:wiki_pages_001), + 'CookBook documentation'] ].each do |record, link| assert_equal link, link_to_record(record) end @@ -1773,7 +1803,8 @@ class ApplicationHelperTest < Redmine::HelperTest [news_attachment, 'eCookbook first release !'], [attachments(:attachments_008), 'Files'], [attachments(:attachments_009), 'Files'], - [attachments(:attachments_003), 'Page with an inline image'], + [attachments(:attachments_003), + 'Page with an inline image'], ].each do |attachment, link| assert_equal link, link_to_attachment_container(attachment.container) end @@ -1838,7 +1869,8 @@ class ApplicationHelperTest < Redmine::HelperTest set_language_if_valid 'en' users = [User.find(2), User.find(4)] User.current = User.find(4) - assert_include '', principals_options_for_select(users) + assert_include '', + principals_options_for_select(users) end def test_stylesheet_link_tag_should_pick_the_default_stylesheet @@ -1846,7 +1878,8 @@ class ApplicationHelperTest < Redmine::HelperTest end def test_stylesheet_link_tag_for_plugin_should_pick_the_plugin_stylesheet - assert_match 'href="/plugin_assets/foo/stylesheets/styles.css"', stylesheet_link_tag("styles", :plugin => :foo) + assert_match 'href="/plugin_assets/foo/stylesheets/styles.css"', + stylesheet_link_tag("styles", :plugin => :foo) end def test_image_tag_should_pick_the_default_image @@ -1976,8 +2009,10 @@ class ApplicationHelperTest < Redmine::HelperTest end def test_html_hours - assert_equal '0:45', html_hours('0:45') - assert_equal '0.75', html_hours('0.75') + assert_equal '0:45', + html_hours('0:45') + assert_equal '0.75', + html_hours('0.75') end def test_form_for_includes_name_attribute @@ -2009,7 +2044,9 @@ class ApplicationHelperTest < Redmine::HelperTest with_locale 'en' do assert_not_equal l(:general_csv_encoding), 'UTF-8' result = export_csv_encoding_select_tag - assert_select_in result, "option[selected='selected'][value=#{l(:general_csv_encoding)}]", :text => l(:general_csv_encoding) + assert_select_in result, + "option[selected='selected'][value=#{l(:general_csv_encoding)}]", + :text => l(:general_csv_encoding) assert_select_in result, "option[value='UTF-8']", :text => 'UTF-8' end end