##// END OF EJS Templates
Test failure (#24865)....
Jean-Philippe Lang -
r15840:1d9e6ebc38ff
parent child
Show More
@@ -1,97 +1,97
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../../test_helper', __FILE__)
19 19
20 20 class QueriesHelperTest < Redmine::HelperTest
21 21 include QueriesHelper
22 22 include Redmine::I18n
23 23
24 24 fixtures :projects, :enabled_modules, :users, :members,
25 25 :member_roles, :roles, :trackers, :issue_statuses,
26 26 :issue_categories, :enumerations, :issues,
27 27 :watchers, :custom_fields, :custom_values, :versions,
28 28 :queries,
29 29 :projects_trackers,
30 30 :custom_fields_trackers
31 31
32 32 def test_filters_options_for_select_should_have_a_blank_option
33 33 options = filters_options_for_select(IssueQuery.new)
34 34 assert_select_in options, 'option[value=""]'
35 35 end
36 36
37 37 def test_filters_options_for_select_should_not_group_regular_filters
38 38 with_locale 'en' do
39 39 options = filters_options_for_select(IssueQuery.new)
40 40 assert_select_in options, 'optgroup option[value=status_id]', 0
41 41 assert_select_in options, 'option[value=status_id]', :text => 'Status'
42 42 end
43 43 end
44 44
45 45 def test_filters_options_for_select_should_group_date_filters
46 46 with_locale 'en' do
47 47 options = filters_options_for_select(IssueQuery.new)
48 48 assert_select_in options, 'optgroup[label=?]', 'Date', 1
49 49 assert_select_in options, 'optgroup > option[value=due_date]', :text => 'Due date'
50 50 end
51 51 end
52 52
53 53 def test_filters_options_for_select_should_not_group_only_one_date_filter
54 54 with_locale 'en' do
55 55 options = filters_options_for_select(TimeEntryQuery.new)
56 56 assert_select_in options, 'option[value=spent_on]'
57 57 assert_select_in options, 'optgroup[label=?]', 'Date', 0
58 58 assert_select_in options, 'optgroup option[value=spent_on]', 0
59 59 end
60 60 end
61 61
62 62 def test_filters_options_for_select_should_group_relations_filters
63 63 with_locale 'en' do
64 64 options = filters_options_for_select(IssueQuery.new)
65 65 assert_select_in options, 'optgroup[label=?]', 'Relations', 1
66 66 assert_select_in options, 'optgroup[label=?] > option', 'Relations', 11
67 67 assert_select_in options, 'optgroup > option[value=relates]', :text => 'Related to'
68 68 end
69 69 end
70 70
71 71 def test_filters_options_for_select_should_group_associations_filters
72 72 CustomField.delete_all
73 73 cf1 = ProjectCustomField.create!(:name => 'Foo', :field_format => 'string', :is_filter => true)
74 74 cf2 = ProjectCustomField.create!(:name => 'Bar', :field_format => 'string', :is_filter => true)
75 75
76 76 with_locale 'en' do
77 77 options = filters_options_for_select(IssueQuery.new)
78 78 assert_select_in options, 'optgroup[label=?]', 'Project', 1
79 79 assert_select_in options, 'optgroup[label=?] > option', 'Project', 2
80 80 assert_select_in options, 'optgroup > option[value=?]', "project.cf_#{cf1.id}", :text => "Project's Foo"
81 81 end
82 82 end
83 83
84 84 def test_query_to_csv_should_translate_boolean_custom_field_values
85 85 f = IssueCustomField.generate!(:field_format => 'bool', :name => 'Boolean', :is_for_all => true, :trackers => Tracker.all)
86 86 issues = [
87 87 Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {f.id.to_s => '0'}),
88 88 Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {f.id.to_s => '1'})
89 89 ]
90 90
91 91 with_locale 'fr' do
92 csv = query_to_csv(issues, IssueQuery.new, :columns => 'all')
92 csv = query_to_csv(issues, IssueQuery.new(:column_names => ['id', "cf_#{f.id}"]))
93 93 assert_include "Oui", csv
94 94 assert_include "Non", csv
95 95 end
96 96 end
97 97 end
General Comments 0
You need to be logged in to leave comments. Login now