Mercurial > hg > soundsoftware-site
comparison test/unit/helpers/queries_helper_test.rb @ 1464:261b3d9a4903 redmine-2.4
Update to Redmine 2.4 branch rev 12663
author | Chris Cannam |
---|---|
date | Tue, 14 Jan 2014 14:37:42 +0000 |
parents | 433d4f72a19b |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1296:038ba2d95de8 | 1464:261b3d9a4903 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
27 :watchers, :custom_fields, :custom_values, :versions, | 27 :watchers, :custom_fields, :custom_values, :versions, |
28 :queries, | 28 :queries, |
29 :projects_trackers, | 29 :projects_trackers, |
30 :custom_fields_trackers | 30 :custom_fields_trackers |
31 | 31 |
32 def test_order | 32 def test_filters_options_has_empty_item |
33 User.current = User.find_by_login('admin') | 33 query = IssueQuery.new |
34 query = Query.new(:project => nil, :name => '_') | 34 filter_count = query.available_filters.size |
35 assert_equal 30, query.available_filters.size | |
36 fo = filters_options(query) | 35 fo = filters_options(query) |
37 assert_equal 31, fo.size | 36 assert_equal filter_count + 1, fo.size |
38 assert_equal [], fo[0] | 37 assert_equal [], fo[0] |
39 assert_equal "status_id", fo[1][1] | |
40 assert_equal "project_id", fo[2][1] | |
41 assert_equal "tracker_id", fo[3][1] | |
42 assert_equal "priority_id", fo[4][1] | |
43 assert_equal "watcher_id", fo[17][1] | |
44 assert_equal "is_private", fo[18][1] | |
45 end | |
46 | |
47 def test_order_custom_fields | |
48 set_language_if_valid 'en' | |
49 field = UserCustomField.new( | |
50 :name => 'order test', :field_format => 'string', | |
51 :is_for_all => true, :is_filter => true | |
52 ) | |
53 assert field.save | |
54 User.current = User.find_by_login('admin') | |
55 query = Query.new(:project => nil, :name => '_') | |
56 assert_equal 32, query.available_filters.size | |
57 fo = filters_options(query) | |
58 assert_equal 33, fo.size | |
59 assert_equal "Searchable field", fo[19][0] | |
60 assert_equal "Database", fo[20][0] | |
61 assert_equal "Project's Development status", fo[21][0] | |
62 assert_equal "Assignee's order test", fo[22][0] | |
63 assert_equal "Author's order test", fo[23][0] | |
64 end | 38 end |
65 end | 39 end |