diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:36:13 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:36:13 +0000 |
commit | 6c5440a21b491982c02531c82b4416ef212eb3dc (patch) | |
tree | 27d069aac9d26f8f6b76b697e8033b18fa65eaa3 /test/unit/project_query_test.rb | |
parent | 868578c0f297875eeac324af8a8c7f1445593ecd (diff) | |
download | redmine-6c5440a21b491982c02531c82b4416ef212eb3dc.tar.gz redmine-6c5440a21b491982c02531c82b4416ef212eb3dc.zip |
Filters for Projects page (#29482).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@18761 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_query_test.rb')
-rw-r--r-- | test/unit/project_query_test.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/unit/project_query_test.rb b/test/unit/project_query_test.rb new file mode 100644 index 000000000..f4182e560 --- /dev/null +++ b/test/unit/project_query_test.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Redmine - project management software +# Copyright (C) 2006-2017 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require File.expand_path('../../test_helper', __FILE__) + +class ProjectQueryTest < ActiveSupport::TestCase + fixtures :projects, :users, + :members, :roles, :member_roles, + :issue_categories, :enumerations, + :groups_users, + :enabled_modules + + def test_filter_values_be_arrays + q = ProjectQuery.new + assert_nil q.project + + q.available_filters.each do |name, filter| + values = filter.values + assert (values.nil? || values.is_a?(Array)), + "#values for #{name} filter returned a #{values.class.name}" + end + end + + def test_project_statuses_filter_should_return_project_statuses + query = ProjectQuery.new(:name => '_') + query.filters = {'status' => {:operator => '=', :values => []}} + + values = query.available_filters['status'][:values] + assert_equal ['active', 'closed'], values.map(&:first) + assert_equal ['1', '5'], values.map(&:second) + + end +end |