summaryrefslogtreecommitdiffstats
path: root/test/functional/search_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-21 18:52:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-21 18:52:45 +0000
commitdad5f6d403dcf70e11065da199f05be49ca2bc48 (patch)
treed983760b79c23a45babe49fa701c2eddd9900e86 /test/functional/search_controller_test.rb
parentc65ab7c0f2722cee919ee2d516bf75f8a85daa21 (diff)
downloadredmine-dad5f6d403dcf70e11065da199f05be49ca2bc48.tar.gz
redmine-dad5f6d403dcf70e11065da199f05be49ca2bc48.zip
Fixed search with all words (broken in r994).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1092 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/search_controller_test.rb')
-rw-r--r--test/functional/search_controller_test.rb33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 330cd0de0..63f1097d6 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -5,7 +5,7 @@ require 'search_controller'
class SearchController; def rescue_action(e) raise e end; end
class SearchControllerTest < Test::Unit::TestCase
- fixtures :projects, :issues, :custom_fields, :custom_values
+ fixtures :projects, :enabled_modules, :issues, :custom_fields, :custom_values
def setup
@controller = SearchController.new
@@ -47,6 +47,37 @@ class SearchControllerTest < Test::Unit::TestCase
assert results.include?(Issue.find(3))
end
+ def test_search_all_words
+ # 'all words' is on by default
+ get :index, :id => 1, :q => 'recipe updating saving'
+ results = assigns(:results)
+ assert_not_nil results
+ assert_equal 1, results.size
+ assert results.include?(Issue.find(3))
+ end
+
+ def test_search_one_of_the_words
+ get :index, :id => 1, :q => 'recipe updating saving', :submit => 'Search'
+ results = assigns(:results)
+ assert_not_nil results
+ assert_equal 3, results.size
+ assert results.include?(Issue.find(3))
+ end
+
+ def test_search_titles_only_without_result
+ get :index, :id => 1, :q => 'recipe updating saving', :all_words => '1', :titles_only => '1', :submit => 'Search'
+ 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'
+ results = assigns(:results)
+ assert_not_nil results
+ assert_equal 2, results.size
+ end
+
def test_quick_jump_to_issue
# issue of a public project
get :index, :q => "3"