summaryrefslogtreecommitdiffstats
path: root/test/functional/search_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-09 21:06:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-09 21:06:09 +0000
commit576a13e99d50a30cfcc9b78d4a0b3793990c0f40 (patch)
tree1e9b16083659bb33c255c05e2efdd9e31dd360ee /test/functional/search_controller_test.rb
parent742895183aebd0e88194ca07c11d94e43e7d24c2 (diff)
downloadredmine-576a13e99d50a30cfcc9b78d4a0b3793990c0f40.tar.gz
redmine-576a13e99d50a30cfcc9b78d4a0b3793990c0f40.zip
Option to search attachment filenames and description (#4383).
git-svn-id: http://svn.redmine.org/redmine/trunk@13856 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/search_controller_test.rb')
-rw-r--r--test/functional/search_controller_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 957ff1e57..d57cc0757 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -180,6 +180,35 @@ class SearchControllerTest < ActionController::TestCase
assert results.include?(Issue.find(7))
end
+ def test_search_without_attachments
+ issue = Issue.generate! :subject => 'search_attachments'
+ attachment = Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
+
+ get :index, :id => 1, :q => 'search_attachments', :attachments => '0'
+ results = assigns(:results)
+ assert_equal 1, results.size
+ assert_equal issue, results.first
+ end
+
+ def test_search_attachments_only
+ issue = Issue.generate! :subject => 'search_attachments'
+ attachment = Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
+
+ get :index, :id => 1, :q => 'search_attachments', :attachments => 'only'
+ results = assigns(:results)
+ assert_equal 1, results.size
+ assert_equal attachment.container, results.first
+ end
+
+ def test_search_with_attachments
+ Issue.generate! :subject => 'search_attachments'
+ Attachment.generate! :container => Issue.find(1), :filename => 'search_attachments.patch'
+
+ get :index, :id => 1, :q => 'search_attachments', :attachments => '1'
+ results = assigns(:results)
+ assert_equal 2, results.size
+ end
+
def test_search_all_words
# 'all words' is on by default
get :index, :id => 1, :q => 'recipe updating saving', :all_words => '1'