From 6188b9eddba7066a691e2a657ebd208391e69272 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 14 Jan 2011 23:37:30 +0000 Subject: [PATCH] Merged r4710 and r4714 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4716 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/repositories_controller.rb | 2 +- .../repositories_git_controller_test.rb | 2 +- .../repositories_mercurial_controller_test.rb | 15 +++++++++++++-- .../repositories_subversion_controller_test.rb | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ceaca4efc..8bd323646 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -225,7 +225,7 @@ class RepositoriesController < ApplicationController end def show_error_not_found - render_error l(:error_scm_not_found) + render_error :message => l(:error_scm_not_found), :status => 404 end # Handler for Redmine::Scm::Adapters::CommandFailed exception diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index e08c41b48..53b5ea7cc 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -192,7 +192,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase @repository.reload ['', ' ', nil].each do |r| get :revision, :id => 1, :rev => r - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end end diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index b577da87e..170e4f8e8 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -32,9 +32,10 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil - Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH) + @repository = Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH) + assert @repository end - + if File.directory?(REPOSITORY_PATH) def test_show get :show, :id => 3 @@ -164,6 +165,16 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase :attributes => { :class => 'line-num' }, :sibling => { :tag => 'td', :content => /watcher =/ } end + + def test_empty_revision + @repository.fetch_changesets + @repository.reload + ['', ' ', nil].each do |r| + get :revision, :id => 3, :rev => r + assert_response 404 + assert_error_tag :content => /was not found/ + end + end else puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!" def test_fake; assert true end diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 5478cee27..1a13797d8 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -168,14 +168,14 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase def test_invalid_revision get :revision, :id => 1, :rev => 'something_weird' - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end def test_empty_revision ['', ' ', nil].each do |r| get :revision, :id => 1, :rev => r - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end end -- 2.39.5