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