]> source.dussan.org Git - redmine.git/commitdiff
Adds a test for invalid query statement.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 4 Dec 2011 16:59:03 +0000 (16:59 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 4 Dec 2011 16:59:03 +0000 (16:59 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8074 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/issues_controller_test.rb

index 24e16e78816119ad8d6ac6ef09000f9bc6290dd6..bf76adafdd26227b6cb9730e58326d2eda44e56f 100644 (file)
@@ -656,6 +656,16 @@ class IssuesControllerTest < ActionController::TestCase
     assert @response.body.blank?
   end
 
+  def test_index_should_rescue_invalid_sql_query
+    Query.any_instance.stubs(:statement).returns("INVALID STATEMENT")
+
+    get :index
+    assert_response 500
+    assert_tag 'p', :content => /An error occurred/
+    assert_nil session[:query]
+    assert_nil session[:issues_index_sort]
+  end
+
   def test_show_by_anonymous
     get :show, :id => 1
     assert_response :success