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
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"