Mercurial > hg > soundsoftware-site
comparison .svn/pristine/01/01b21d04c9e912327dc0059ef282ceb1a603f54f.svn-base @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
| author | Chris Cannam |
|---|---|
| date | Fri, 14 Jun 2013 09:02:21 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1294:3e4c3460b6ca | 1295:622f24f53b42 |
|---|---|
| 1 # Redmine - project management software | |
| 2 # Copyright (C) 2006-2013 Jean-Philippe Lang | |
| 3 # | |
| 4 # This program is free software; you can redistribute it and/or | |
| 5 # modify it under the terms of the GNU General Public License | |
| 6 # as published by the Free Software Foundation; either version 2 | |
| 7 # of the License, or (at your option) any later version. | |
| 8 # | |
| 9 # This program is distributed in the hope that it will be useful, | |
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 # GNU General Public License for more details. | |
| 13 # | |
| 14 # You should have received a copy of the GNU General Public License | |
| 15 # along with this program; if not, write to the Free Software | |
| 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 17 | |
| 18 require File.expand_path('../../test_helper', __FILE__) | |
| 19 | |
| 20 class AutoCompletesControllerTest < ActionController::TestCase | |
| 21 fixtures :projects, :issues, :issue_statuses, | |
| 22 :enumerations, :users, :issue_categories, | |
| 23 :trackers, | |
| 24 :projects_trackers, | |
| 25 :roles, | |
| 26 :member_roles, | |
| 27 :members, | |
| 28 :enabled_modules, | |
| 29 :journals, :journal_details | |
| 30 | |
| 31 def test_issues_should_not_be_case_sensitive | |
| 32 get :issues, :project_id => 'ecookbook', :q => 'ReCiPe' | |
| 33 assert_response :success | |
| 34 assert_not_nil assigns(:issues) | |
| 35 assert assigns(:issues).detect {|issue| issue.subject.match /recipe/} | |
| 36 end | |
| 37 | |
| 38 def test_issues_should_accept_term_param | |
| 39 get :issues, :project_id => 'ecookbook', :term => 'ReCiPe' | |
| 40 assert_response :success | |
| 41 assert_not_nil assigns(:issues) | |
| 42 assert assigns(:issues).detect {|issue| issue.subject.match /recipe/} | |
| 43 end | |
| 44 | |
| 45 def test_issues_should_return_issue_with_given_id | |
| 46 get :issues, :project_id => 'subproject1', :q => '13' | |
| 47 assert_response :success | |
| 48 assert_not_nil assigns(:issues) | |
| 49 assert assigns(:issues).include?(Issue.find(13)) | |
| 50 end | |
| 51 | |
| 52 def test_issues_should_return_issue_with_given_id_preceded_with_hash | |
| 53 get :issues, :project_id => 'subproject1', :q => '#13' | |
| 54 assert_response :success | |
| 55 assert_not_nil assigns(:issues) | |
| 56 assert assigns(:issues).include?(Issue.find(13)) | |
| 57 end | |
| 58 | |
| 59 def test_auto_complete_with_scope_all_should_search_other_projects | |
| 60 get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all' | |
| 61 assert_response :success | |
| 62 assert_not_nil assigns(:issues) | |
| 63 assert assigns(:issues).include?(Issue.find(13)) | |
| 64 end | |
| 65 | |
| 66 def test_auto_complete_without_project_should_search_all_projects | |
| 67 get :issues, :q => '13' | |
| 68 assert_response :success | |
| 69 assert_not_nil assigns(:issues) | |
| 70 assert assigns(:issues).include?(Issue.find(13)) | |
| 71 end | |
| 72 | |
| 73 def test_auto_complete_without_scope_all_should_not_search_other_projects | |
| 74 get :issues, :project_id => 'ecookbook', :q => '13' | |
| 75 assert_response :success | |
| 76 assert_equal [], assigns(:issues) | |
| 77 end | |
| 78 | |
| 79 def test_issues_should_return_json | |
| 80 get :issues, :project_id => 'subproject1', :q => '13' | |
| 81 assert_response :success | |
| 82 json = ActiveSupport::JSON.decode(response.body) | |
| 83 assert_kind_of Array, json | |
| 84 issue = json.first | |
| 85 assert_kind_of Hash, issue | |
| 86 assert_equal 13, issue['id'] | |
| 87 assert_equal 13, issue['value'] | |
| 88 assert_equal 'Bug #13: Subproject issue two', issue['label'] | |
| 89 end | |
| 90 end |
