diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-04-01 15:08:52 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-04-01 15:08:52 +0000 |
commit | 83ed32e8d71fdb8c6a7492a4d82db2d52889534d (patch) | |
tree | 3350f753132d7a1d34c7bd83e0c5a4b6fae5db36 /test/unit/project_query_test.rb | |
parent | 44344cfe8a8693ade7ecd855d20c2ce8857dc302 (diff) | |
download | redmine-83ed32e8d71fdb8c6a7492a4d82db2d52889534d.tar.gz redmine-83ed32e8d71fdb8c6a7492a4d82db2d52889534d.zip |
Reuse ProjectQuery filters on the admin project list (#33422).
Patch by Takenori TAKAKI.
git-svn-id: https://svn.redmine.org/redmine/trunk@21519 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_query_test.rb')
-rw-r--r-- | test/unit/project_query_test.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/project_query_test.rb b/test/unit/project_query_test.rb index 8166e8363..0471c1df8 100644 --- a/test/unit/project_query_test.rb +++ b/test/unit/project_query_test.rb @@ -62,6 +62,18 @@ class ProjectQueryTest < ActiveSupport::TestCase assert_include :cf_3, query.available_columns.map(&:name) end + def test_available_display_types_should_returns_bord_and_list + query = ProjectQuery.new + query.admin_projects = nil + assert_equal ['board', 'list'], query.available_display_types + end + + def test_available_display_types_should_always_returns_list_when_admin_projects_is_set + query = ProjectQuery.new + query.admin_projects = 1 + assert_equal ['list'], query.available_display_types + end + def test_display_type_default_should_equal_with_setting_project_list_display_type ProjectQuery.new.available_display_types.each do |t| with_settings :project_list_display_type => t do @@ -104,4 +116,36 @@ class ProjectQueryTest < ActiveSupport::TestCase assert_nil ProjectQuery.default end + + def test_display_type_should_returns_list_when_admin_projects_is_set + q = ProjectQuery.new + q.admin_projects = 1 + assert_equal 'list', q.display_type + end + + def test_project_statuses_values_should_equal_ancestors_return + ancestor = Query.new + q = ProjectQuery.new + assert_equal ancestor.project_statuses_values, q.project_statuses_values + end + + def test_project_statuses_values_should_includes_project_status_archeved_when_admin_projects_is_set + q = ProjectQuery.new + q.admin_projects = 1 + assert_includes q.project_statuses_values, [l(:project_status_archived), Project::STATUS_ARCHIVED.to_s] + Query.new.project_statuses_values.each do |status| + assert_includes q.project_statuses_values, status + end + end + + def test_base_scope_should_return_visible_projects + q = ProjectQuery.new + assert_equal Project.visible, q.base_scope + end + + def test_base_scope_should_return_all_projects_when_admin_projects_is_set + q = ProjectQuery.new + q.admin_projects = 1 + assert_equal Project.all, q.base_scope + end end |