summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-09-11 06:39:00 +0000
committerGo MAEDA <maeda@farend.jp>2019-09-11 06:39:00 +0000
commit3ba5e04f5ed4c0c88444dd076287b5256ffbfbf6 (patch)
treed5ffbcba7d56d5fb6587e4759cbbfd72c90bd931 /test/functional
parentdc657cb2c00da0bf3edaa9be4020ab05c0472b55 (diff)
downloadredmine-3ba5e04f5ed4c0c88444dd076287b5256ffbfbf6.tar.gz
redmine-3ba5e04f5ed4c0c88444dd076287b5256ffbfbf6.zip
Issue auto complete should return last 10 issues (#31994).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18449 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/auto_completes_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/auto_completes_controller_test.rb b/test/functional/auto_completes_controller_test.rb
index 8d815267f..825ebf8e9 100644
--- a/test/functional/auto_completes_controller_test.rb
+++ b/test/functional/auto_completes_controller_test.rb
@@ -150,4 +150,20 @@ class AutoCompletesControllerTest < Redmine::ControllerTest
assert_response :success
assert_include 'application/json', response.headers['Content-Type']
end
+
+ def test_auto_complete_without_term_should_return_last_10_updated_issues
+ # There are 9 issues generated by fixtures
+ # and we need two more to test the 10 limit
+ %w(1..2).each do
+ Issue.generate!
+ end
+
+ get :issues
+
+ assert_response :success
+ json = ActiveSupport::JSON.decode(response.body)
+
+ assert_equal 10, json.count
+ assert_equal Issue.last.id, json.first['id'].to_i
+ end
end