Feature #34863 » 0003-Change-the-text-formatting-of-fixtures-to-Markdown.patch
| test/fixtures/journals.yml | ||
|---|---|---|
|
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:  and a reference to #1 and r2."
|
||
|
id: 3
|
||
|
journalized_type: Issue
|
||
|
user_id: 2
|
||
| test/fixtures/wiki_content_versions.yml | ||
|---|---|---|
|
wiki_content_id: 1
|
||
|
compression: ""
|
||
|
data: |-
|
||
|
h1. CookBook documentation v1
|
||
|
# CookBook documentation v1
|
||
|
|
||
|
Line from v1
|
||
| ... | ... | |
|
wiki_content_id: 1
|
||
|
compression: ""
|
||
|
data: |-
|
||
|
h1. CookBook documentation v2
|
||
|
# CookBook documentation v2
|
||
|
|
||
|
Line from v1
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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.
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
comments:
|
||
|
wiki_content_versions_007:
|
||
|
data: |-
|
||
|
h1. Page with an inline image
|
||
|
# Page with an inline image
|
||
|
|
||
|
This is an inline image:
|
||
|
|
||
|
!logo.gif!
|
||
|

|
||
|
updated_on: 2007-03-08 00:18:07 +01:00
|
||
|
page_id: 4
|
||
|
wiki_content_id: 4
|
||
| test/fixtures/wiki_contents.yml | ||
|---|---|---|
|
---
|
||
|
wiki_contents_001:
|
||
|
text: |-
|
||
|
h1. CookBook documentation
|
||
|
# CookBook documentation
|
||
|
{{child_pages}}
|
||
| ... | ... | |
|
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:
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
comments:
|
||
|
wiki_contents_004:
|
||
|
text: |-
|
||
|
h1. Page with an inline image
|
||
|
# Page with an inline image
|
||
|
|
||
|
This is an inline image:
|
||
|
|
||
|
!logo.gif!
|
||
|

|
||
|
updated_on: 2007-03-08 00:18:07 +01:00
|
||
|
page_id: 4
|
||
|
id: 4
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| test/functional/issues_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_index_with_last_notes_column
|
||
|
with_settings :text_formatting => 'textile' do
|
||
|
with_settings :text_formatting => 'markdown' do
|
||
|
get(
|
||
|
:index,
|
||
|
:params => {
|
||
| ... | ... | |
|
end
|
||
|
def test_show_atom
|
||
|
with_settings :text_formatting => 'textile' do
|
||
|
with_settings :text_formatting => 'markdown' do
|
||
|
get(
|
||
|
:show,
|
||
|
:params => {
|
||
| test/functional/wiki_controller_test.rb | ||
|---|---|---|
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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'}
|
||
| ... | ... | |
|
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}
|
||
| ... | ... | |
|
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"]'
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| test/helpers/application_helper_test.rb | ||
|---|---|---|
|
raw = <<~RAW
|
||
|
{{toc}}
|
||
|
h1. Included
|
||
|
# Included
|
||
|
{{include(Child_1)}}
|
||
|
RAW
|
||
| ... | ... | |
|
'<li><a href="#Child-page-1">Child page 1</a></li>' +
|
||
|
'</ul>'
|
||
|
@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
|
||