diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-05-27 09:12:42 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-05-27 09:12:42 +0000 |
commit | ba37a2c47686770048f66a1af6f4294f4168089b (patch) | |
tree | ea366efdfc9ef074e096f7b900b34d61121bc8d5 /test | |
parent | 335a16e4fd28ce464fb45e79fac456b5d6bf88fa (diff) | |
download | redmine-ba37a2c47686770048f66a1af6f4294f4168089b.tar.gz redmine-ba37a2c47686770048f66a1af6f4294f4168089b.zip |
Show statuses of project trackers only (#5385).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@16575 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/project_test.rb | 15 | ||||
-rw-r--r-- | test/unit/query_test.rb | 26 |
2 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 66d6fa3b2..24f695831 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -483,6 +483,21 @@ class ProjectTest < ActiveSupport::TestCase assert_equal [1,2], parent.rolled_up_trackers.collect(&:id) end + def test_rolled_up_statuses + project = Project.find(1) + + WorkflowTransition.delete_all + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3) + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4) + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3) + WorkflowTransition.create(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 3) + + assert_kind_of IssueStatus, project.rolled_up_statuses.first + assert_equal IssueStatus.find(1), project.rolled_up_statuses.first + + assert_equal [1, 2, 3, 4], project.rolled_up_statuses.collect(&:id) + end + test "#rolled_up_trackers should ignore projects with issue_tracking module disabled" do parent = Project.generate! parent.trackers = Tracker.find([1, 2]) diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 09d9508d6..5cbcb40af 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -2093,4 +2093,30 @@ class QueryTest < ActiveSupport::TestCase issues = find_issues_with_query(query) assert_equal [1, 2, 5, 11, 12, 13], issues.map(&:id).sort end + + def test_issue_statuses_should_return_only_statuses_used_by_that_project + query = IssueQuery.new(:name => '_', :project => Project.find(1)) + query.filters = {'status_id' => {:operator => '=', :values => []}} + + WorkflowTransition.delete_all + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3) + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4) + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3) + WorkflowTransition.create(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 3) + + assert_equal ['1','2','3','4'], query.available_filters['status_id'][:values].map(&:second) + end + + def test_issue_statuses_without_project_should_return_all_statuses + query = IssueQuery.new(:name => '_') + query.filters = {'status_id' => {:operator => '=', :values => []}} + + WorkflowTransition.delete_all + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3) + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4) + WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3) + WorkflowTransition.create(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 3) + + assert_equal ['1','2','3','4','5','6'], query.available_filters['status_id'][:values].map(&:second) + end end |