From 37480b4658b9b7837483a7acbaf25f25461a7348 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Tue, 16 Mar 2021 18:34:55 +0900 Subject: [PATCH 3/3] Change the text formatting of fixtures to Markdown --- test/fixtures/journals.yml | 2 +- test/fixtures/wiki_content_versions.yml | 24 ++++++++-------- test/fixtures/wiki_contents.yml | 22 +++++++-------- test/functional/issues_controller_test.rb | 4 +-- test/functional/wiki_controller_test.rb | 34 +++++++++++------------ test/helpers/application_helper_test.rb | 4 +-- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/test/fixtures/journals.yml b/test/fixtures/journals.yml index bc7bc91b9..468b888b7 100644 --- a/test/fixtures/journals.yml +++ b/test/fixtures/journals.yml @@ -15,7 +15,7 @@ journals_002: journalized_id: 1 journals_003: created_on: <%= 1.days.ago.to_date.to_s(:db) %> - notes: "A comment with inline image: !picture.jpg! and a reference to #1 and r2." + notes: "A comment with inline image: ![](picture.jpg) and a reference to #1 and r2." id: 3 journalized_type: Issue user_id: 2 diff --git a/test/fixtures/wiki_content_versions.yml b/test/fixtures/wiki_content_versions.yml index 99be463d8..218847d41 100644 --- a/test/fixtures/wiki_content_versions.yml +++ b/test/fixtures/wiki_content_versions.yml @@ -9,7 +9,7 @@ wiki_content_versions_001: wiki_content_id: 1 compression: "" data: |- - h1. CookBook documentation v1 + # CookBook documentation v1 Line from v1 @@ -24,7 +24,7 @@ wiki_content_versions_002: wiki_content_id: 1 compression: "" data: |- - h1. CookBook documentation v2 + # CookBook documentation v2 Line from v1 @@ -39,12 +39,12 @@ wiki_content_versions_003: wiki_content_id: 1 compression: "" data: |- - h1. CookBook documentation v3 + # CookBook documentation v3 Some updated [[documentation]] here... wiki_content_versions_004: data: |- - h1. Another page + # Another page This is a link to a ticket: #2 updated_on: 2007-03-08 00:18:07 +01:00 @@ -56,13 +56,13 @@ wiki_content_versions_004: comments: wiki_content_versions_005: data: |- - h1. Title + # Title Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. - h2. Heading 1 + ## Heading 1 - @WHATEVER@ + `WHATEVER` Maecenas sed elit sit amet mi accumsan vestibulum non nec velit. Proin porta tincidunt lorem, consequat rhoncus dolor fermentum in. @@ -80,17 +80,17 @@ wiki_content_versions_005: comments: wiki_content_versions_006: data: |- - h1. Title + # Title Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. - h2. Heading 1 + ## Heading 1 @WHATEVER@ Maecenas sed elit sit amet mi accumsan vestibulum non nec velit. Proin porta tincidunt lorem, consequat rhoncus dolor fermentum in. - h2. Heading 2 + ## Heading 2 Morbi facilisis accumsan orci non pharetra. updated_on: 2007-03-08 00:18:07 +01:00 @@ -102,11 +102,11 @@ wiki_content_versions_006: comments: wiki_content_versions_007: data: |- - h1. Page with an inline image + # Page with an inline image This is an inline image: - !logo.gif! + ![](logo.gif) updated_on: 2007-03-08 00:18:07 +01:00 page_id: 4 wiki_content_id: 4 diff --git a/test/fixtures/wiki_contents.yml b/test/fixtures/wiki_contents.yml index 9961eb4ad..788c3a777 100644 --- a/test/fixtures/wiki_contents.yml +++ b/test/fixtures/wiki_contents.yml @@ -1,7 +1,7 @@ --- wiki_contents_001: text: |- - h1. CookBook documentation + # CookBook documentation {{child_pages}} @@ -14,7 +14,7 @@ wiki_contents_001: comments: Gzip compression activated wiki_contents_002: text: |- - h1. Another page + # Another page This is a link to a ticket: #2 And this is an included page: @@ -27,7 +27,7 @@ wiki_contents_002: comments: wiki_contents_003: text: |- - h1. Start page + # Start page E-commerce web site start page updated_on: 2007-03-08 00:18:07 +01:00 @@ -38,11 +38,11 @@ wiki_contents_003: comments: wiki_contents_004: text: |- - h1. Page with an inline image + # Page with an inline image This is an inline image: - !logo.gif! + ![](logo.gif) updated_on: 2007-03-08 00:18:07 +01:00 page_id: 4 id: 4 @@ -51,7 +51,7 @@ wiki_contents_004: comments: wiki_contents_005: text: |- - h1. Child page 1 + # Child page 1 This is a child page updated_on: 2007-03-08 00:18:07 +01:00 @@ -62,7 +62,7 @@ wiki_contents_005: comments: wiki_contents_006: text: |- - h1. Child page 2 + # Child page 2 This is a child page updated_on: 2007-03-08 00:18:07 +01:00 @@ -105,19 +105,19 @@ wiki_contents_010: comments: wiki_contents_011: text: |- - h1. Title + # Title Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. - h2. Heading 1 + ## Heading 1 - @WHATEVER@ + `WHATEVER` Maecenas sed elit sit amet mi accumsan vestibulum non nec velit. Proin porta tincidunt lorem, consequat rhoncus dolor fermentum in. Cras ipsum felis, ultrices at porttitor vel, faucibus eu nunc. - h2. Heading 2 + ## Heading 2 Morbi facilisis accumsan orci non pharetra. updated_on: 2007-03-08 00:18:07 +01:00 diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 822b10e26..6ab2bf6e9 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1701,7 +1701,7 @@ class IssuesControllerTest < Redmine::ControllerTest end def test_index_with_last_notes_column - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do get( :index, :params => { @@ -2862,7 +2862,7 @@ class IssuesControllerTest < Redmine::ControllerTest end def test_show_atom - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do get( :show, :params => { diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index cc0fb0dd4..eaf640f21 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -30,7 +30,7 @@ class WikiControllerTest < Redmine::ControllerTest end def test_show_start_page - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do get :show, :params => {:project_id => 'ecookbook'} assert_response :success @@ -49,7 +49,7 @@ class WikiControllerTest < Redmine::ControllerTest end def test_show_page_with_name - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do get :show, :params => {:project_id => 1, :id => 'Another_page'} assert_response :success @@ -118,7 +118,7 @@ class WikiControllerTest < Redmine::ControllerTest end def test_show_should_display_section_edit_links - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 get :show, :params => {:project_id => 1, :id => 'Page with sections'} @@ -129,7 +129,7 @@ class WikiControllerTest < Redmine::ControllerTest end def test_show_current_version_should_display_section_edit_links - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 3} @@ -328,14 +328,14 @@ class WikiControllerTest < Redmine::ControllerTest end def test_edit_section - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2} assert_response :success page = WikiPage.find_by_title('Page_with_sections') - section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) + section, hash = Redmine::WikiFormatting::Markdown::Formatter.new(page.content.text).get_section(2) assert_select 'textarea[name=?]', 'content[text]', :text => section assert_select 'input[name=section][type=hidden][value="2"]' @@ -566,10 +566,10 @@ class WikiControllerTest < Redmine::ControllerTest end def test_update_section - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 page = WikiPage.find_by(title: 'Page_with_sections') - section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) + section, hash = Redmine::WikiFormatting::Markdown::Formatter.new(page.content.text).get_section(2) text = page.content.text assert_no_difference 'WikiPage.count' do @@ -589,15 +589,15 @@ class WikiControllerTest < Redmine::ControllerTest end end assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections#section-2' - assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, 'New section content'), page.reload.content.text + assert_equal Redmine::WikiFormatting::Markdown::Formatter.new(text).update_section(2, 'New section content'), page.reload.content.text end end def test_update_section_should_allow_stale_page_update - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 page = WikiPage.find_by(title: 'Page_with_sections') - section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) + section, hash = Redmine::WikiFormatting::Markdown::Formatter.new(page.content.text).get_section(2) text = page.content.text assert_no_difference 'WikiPage.count' do @@ -618,7 +618,7 @@ class WikiControllerTest < Redmine::ControllerTest end assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections#section-2' page.reload - assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, 'New section content'), page.content.text + assert_equal Redmine::WikiFormatting::Markdown::Formatter.new(text).update_section(2, 'New section content'), page.content.text assert_equal 4, page.content.version end end @@ -764,7 +764,7 @@ class WikiControllerTest < Redmine::ControllerTest assert_select 'table.annotate tr:nth-child(1)' do assert_select 'th.line-num', :text => '1' assert_select 'td.author', :text => /Redmine Admin/ - assert_select 'td', :text => /h1\. CookBook documentation v2/ + assert_select 'td', :text => /# CookBook documentation v2/ end # Line 2 @@ -1119,7 +1119,7 @@ class WikiControllerTest < Redmine::ControllerTest end def test_show_html - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 get :show, :params => {:project_id => 1, :format => 'html'} assert_response :success @@ -1132,7 +1132,7 @@ class WikiControllerTest < Redmine::ControllerTest end def test_show_versioned_html - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do @request.session[:user_id] = 2 get :show, :params => {:project_id => 1, :format => 'html', :version => 2} assert_response :success @@ -1152,7 +1152,7 @@ class WikiControllerTest < Redmine::ControllerTest assert_equal 'text/plain', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.txt"', @response.headers['Content-Disposition'] - assert_include 'h1. CookBook documentation', @response.body + assert_include '# CookBook documentation', @response.body end def test_show_versioned_txt @@ -1163,7 +1163,7 @@ class WikiControllerTest < Redmine::ControllerTest assert_equal 'text/plain', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.txt"', @response.headers['Content-Disposition'] - assert_include 'h1. CookBook documentation v2', @response.body + assert_include '# CookBook documentation v2', @response.body end def test_show_filename_should_be_uri_encoded_for_ms_browsers diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index ca0421d7b..b143754ec 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1591,7 +1591,7 @@ class ApplicationHelperTest < Redmine::HelperTest raw = <<~RAW {{toc}} - h1. Included + # Included {{include(Child_1)}} RAW @@ -1601,7 +1601,7 @@ class ApplicationHelperTest < Redmine::HelperTest '
  • Child page 1
  • ' + '' @project = Project.find(1) - with_settings :text_formatting => 'textile' do + with_settings :text_formatting => 'markdown' do assert textilizable(raw).delete("\n").include?(expected) end end -- 2.29.2