diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-05-30 12:49:07 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-05-30 12:49:07 +0000 |
commit | f76a85dc5a92a5290659e3d6a36ecd630c740ba3 (patch) | |
tree | 7537d188605b5d599944da79858a4946bdf9544f /test | |
parent | 7aa642ad7acbf40083b4e870acf8aa71d27eb0e9 (diff) | |
download | redmine-f76a85dc5a92a5290659e3d6a36ecd630c740ba3.tar.gz redmine-f76a85dc5a92a5290659e3d6a36ecd630c740ba3.zip |
scm: fix error when *.yml and *.txt show (#31141, #30850)
Contributed by Mizuki ISHIKAWA.
git-svn-id: http://svn.redmine.org/redmine/trunk@18211 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/repositories_git_test.rb | 25 | ||||
-rw-r--r-- | test/integration/routing/repositories_test.rb | 20 |
2 files changed, 39 insertions, 6 deletions
diff --git a/test/integration/repositories_git_test.rb b/test/integration/repositories_git_test.rb index 931c72673..ecacb9ac3 100644 --- a/test/integration/repositories_git_test.rb +++ b/test/integration/repositories_git_test.rb @@ -78,6 +78,31 @@ class RepositoriesGitTest < Redmine::IntegrationTest assert_match /\Acommit deff712f05a90d96edbd70facc47d944be5897e3/, response.body end + def test_get_diff_with_format_text_should_return_html + @repository.fetch_changesets + assert_equal NUM_REV, @repository.changesets.count + + get "/projects/subproject1/repository/#{@repository.id}/revisions/deff712f05a90d96edbd70facc47d944be5897e3/diff/sources/watchers_controller.rb", :params => { :format => 'txt' } + assert_response :success + + assert a = css_select("a.diff").first + assert_equal 'Unified diff', a.text + get a['href'] + assert_response :success + assert_match /\Acommit deff712f05a90d96edbd70facc47d944be5897e3/, response.body + end + + def test_entry_txt_should_return_html + @repository.fetch_changesets + assert_equal NUM_REV, @repository.changesets.count + + get "/projects/subproject1/repository/#{@repository.id}/revisions/deff712f05a90d96edbd70facc47d944be5897e3/entry/new_file.txt" + assert_response :success + + assert l1 = css_select("#L1").first + assert l1_code = css_select(l1, "td.line-code").first + assert_match 'This is a brand new file', l1_code.text + end else puts "Git test repository NOT FOUND. Skipping integration tests !!!" def test_fake; assert true end diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb index fe5124ac7..44e5f99e4 100644 --- a/test/integration/routing/repositories_test.rb +++ b/test/integration/routing/repositories_test.rb @@ -55,26 +55,34 @@ class RoutingRepositoriesTest < Redmine::RoutingTest should_route 'GET /projects/foo/repository/foo/revisions.atom' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo', :format => 'atom' should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457' - should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457' + should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html' should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457' - %w(show diff entry raw annotate).each do |action| + %w(show entry raw annotate).each do |action| @paths.each do |path| should_route "GET /projects/foo/repository/foo/revisions/2457/#{action}/#{path}" => "repositories##{action}", - :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path + :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path, :format => 'html' end end + @paths.each do |path| + should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{path}" => "repositories#diff", + :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path + end end def test_repositories_non_revisions_path_with_repository_id - should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn' + should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn', :format => 'html' - %w(changes diff browse entry raw annotate).each do |action| + %w(changes browse entry raw annotate).each do |action| @paths.each do |path| should_route "GET /projects/foo/repository/svn/#{action}/#{path}" => "repositories##{action}", - :id => 'foo', :repository_id => 'svn', :path => path + :id => 'foo', :repository_id => 'svn', :path => path, :format => 'html' end end + @paths.each do |path| + should_route "GET /projects/foo/repository/svn/diff/#{path}" => "repositories#diff", + :id => 'foo', :repository_id => 'svn', :path => path + end end def test_repositories_related_issues_with_repository_id |