summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-05-28 08:37:30 +0000
committerGo MAEDA <maeda@farend.jp>2021-05-28 08:37:30 +0000
commit5ac8f70d108a4d41e3f5954845bf64946e5caa28 (patch)
treee883e410a2b637d01e6701a3df51025cca6298a4 /test
parent66fc9f463dbca69529df106338cafcc46f5fa115 (diff)
downloadredmine-5ac8f70d108a4d41e3f5954845bf64946e5caa28.tar.gz
redmine-5ac8f70d108a4d41e3f5954845bf64946e5caa28.zip
Render Textile and Markdown files in the repository browser (#16849).
Patch by Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@21013 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/repositories/subversion_repository.dump.gzbin114931 -> 115356 bytes
-rw-r--r--test/functional/repositories_subversion_controller_test.rb31
-rw-r--r--test/unit/repository_subversion_test.rb6
3 files changed, 32 insertions, 5 deletions
diff --git a/test/fixtures/repositories/subversion_repository.dump.gz b/test/fixtures/repositories/subversion_repository.dump.gz
index f08858eed..0151f83e1 100644
--- a/test/fixtures/repositories/subversion_repository.dump.gz
+++ b/test/fixtures/repositories/subversion_repository.dump.gz
Binary files differ
diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb
index 6988d2a5d..f6db7c002 100644
--- a/test/functional/repositories_subversion_controller_test.rb
+++ b/test/functional/repositories_subversion_controller_test.rb
@@ -27,7 +27,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
PRJ_ID = 3
- NUM_REV = 12
+ NUM_REV = 13
def setup
super
@@ -204,7 +204,8 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
)
assert_response :success
assert_select 'table.changesets tbody' do
- assert_select 'tr', 7
+ assert_select 'tr', 8
+ assert_select 'tr td.id a', :text => '13'
assert_select 'tr td.id a', :text => '12'
assert_select 'tr td.id a', :text => '10'
assert_select 'tr td.id a', :text => '9'
@@ -280,6 +281,32 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
assert_select 'audio[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/chords.mp3"
end
+ def text_entry_should_preview_markdown
+ get(
+ :entry,
+ :params => {
+ :id => PRJ_ID,
+ :repository_id => @repository.id,
+ :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'testfile.md'])[:param]
+ }
+ )
+ assert_response :success
+ assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>"
+ end
+
+ def text_entry_should_preview_textile
+ get(
+ :entry,
+ :params => {
+ :id => PRJ_ID,
+ :repository_id => @repository.id,
+ :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'testfile.textile'])[:param]
+ }
+ )
+ assert_response :success
+ assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n\n\t<h2>Header 2</h2>\n\n\n\t<h3>Header 3</h3>"
+ end
+
def test_entry_at_given_revision
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb
index 37364aa9c..1b4586dec 100644
--- a/test/unit/repository_subversion_test.rb
+++ b/test/unit/repository_subversion_test.rb
@@ -24,7 +24,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
include Redmine::I18n
- NUM_REV = 12
+ NUM_REV = 13
def setup
User.current = nil
@@ -100,7 +100,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- assert_equal 21, @repository.filechanges.count
+ assert_equal 23, @repository.filechanges.count
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
end
@@ -144,7 +144,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
# with path
changesets = @repository.latest_changesets('subversion_test/folder', nil)
- assert_equal ["12", "10", "9", "7", "6", "5", "2"], changesets.collect(&:revision)
+ assert_equal ["13", "12", "10", "9", "7", "6", "5", "2"], changesets.collect(&:revision)
# with path and revision
changesets = @repository.latest_changesets('subversion_test/folder', 8)