annotate test/functional/auto_completes_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 8661b858af72
children cbb26bc654de
rev   line source
Chris@119 1 require File.expand_path('../../test_helper', __FILE__)
Chris@14 2
Chris@14 3 class AutoCompletesControllerTest < ActionController::TestCase
Chris@14 4 fixtures :all
Chris@14 5
Chris@14 6 def test_issues_should_not_be_case_sensitive
Chris@14 7 get :issues, :project_id => 'ecookbook', :q => 'ReCiPe'
Chris@14 8 assert_response :success
Chris@14 9 assert_not_nil assigns(:issues)
Chris@14 10 assert assigns(:issues).detect {|issue| issue.subject.match /recipe/}
Chris@14 11 end
Chris@14 12
Chris@14 13 def test_issues_should_return_issue_with_given_id
Chris@14 14 get :issues, :project_id => 'subproject1', :q => '13'
Chris@14 15 assert_response :success
Chris@14 16 assert_not_nil assigns(:issues)
Chris@14 17 assert assigns(:issues).include?(Issue.find(13))
Chris@14 18 end
Chris@14 19
Chris@119 20 def test_auto_complete_with_scope_all_and_cross_project_relations
Chris@119 21 Setting.cross_project_issue_relations = '1'
Chris@119 22 get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all'
Chris@119 23 assert_response :success
Chris@119 24 assert_not_nil assigns(:issues)
Chris@119 25 assert assigns(:issues).include?(Issue.find(13))
Chris@119 26 end
Chris@119 27
Chris@119 28 def test_auto_complete_with_scope_all_without_cross_project_relations
Chris@119 29 Setting.cross_project_issue_relations = '0'
Chris@119 30 get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all'
Chris@119 31 assert_response :success
Chris@119 32 assert_equal [], assigns(:issues)
Chris@119 33 end
Chris@14 34 end