Mercurial > hg > soundsoftware-site
diff test/functional/search_controller_test.rb @ 507:0c939c159af4 redmine-1.2
Update to Redmine 1.2.1 on 1.2-stable branch (Redmine SVN rev 6270)
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:32:19 +0100 |
parents | cbce1fd3b1b7 |
children | cbb26bc654de |
line wrap: on
line diff
--- a/test/functional/search_controller_test.rb Mon Jun 06 14:24:13 2011 +0100 +++ b/test/functional/search_controller_test.rb Thu Jul 14 10:32:19 2011 +0100 @@ -29,7 +29,7 @@ end def test_search_all_projects - get :index, :q => 'recipe subproject commit', :submit => 'Search' + get :index, :q => 'recipe subproject commit', :all_words => '' assert_response :success assert_template 'index' @@ -50,6 +50,8 @@ assert_response :success assert_template 'index' + assert_equal true, assigns(:all_words) + assert_equal false, assigns(:titles_only) assert assigns(:results).include?(Issue.find(8)) assert assigns(:results).include?(Issue.find(5)) assert_tag :dt, :attributes => { :class => /issue closed/ }, @@ -57,7 +59,7 @@ end def test_search_project_and_subprojects - get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search' + get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :all_words => '' assert_response :success assert_template 'index' assert assigns(:results).include?(Issue.find(1)) @@ -88,7 +90,8 @@ def test_search_all_words # 'all words' is on by default - get :index, :id => 1, :q => 'recipe updating saving' + get :index, :id => 1, :q => 'recipe updating saving', :all_words => '1' + assert_equal true, assigns(:all_words) results = assigns(:results) assert_not_nil results assert_equal 1, results.size @@ -96,7 +99,8 @@ end def test_search_one_of_the_words - get :index, :id => 1, :q => 'recipe updating saving', :submit => 'Search' + get :index, :id => 1, :q => 'recipe updating saving', :all_words => '' + assert_equal false, assigns(:all_words) results = assigns(:results) assert_not_nil results assert_equal 3, results.size @@ -104,19 +108,30 @@ end def test_search_titles_only_without_result - get :index, :id => 1, :q => 'recipe updating saving', :all_words => '1', :titles_only => '1', :submit => 'Search' + get :index, :id => 1, :q => 'recipe updating saving', :titles_only => '1' results = assigns(:results) assert_not_nil results assert_equal 0, results.size end def test_search_titles_only - get :index, :id => 1, :q => 'recipe', :titles_only => '1', :submit => 'Search' + get :index, :id => 1, :q => 'recipe', :titles_only => '1' + assert_equal true, assigns(:titles_only) results = assigns(:results) assert_not_nil results assert_equal 2, results.size end + def test_search_content + Issue.update_all("description = 'This is a searchkeywordinthecontent'", "id=1") + + get :index, :id => 1, :q => 'searchkeywordinthecontent', :titles_only => '' + assert_equal false, assigns(:titles_only) + results = assigns(:results) + assert_not_nil results + assert_equal 1, results.size + end + def test_search_with_invalid_project_id get :index, :id => 195, :q => 'recipe' assert_response 404