]> source.dussan.org Git - redmine.git/commitdiff
Adds test for #41678 (#23954).
authorMarius Balteanu <marius.balteanu@zitec.com>
Sun, 3 Nov 2024 11:53:53 +0000 (11:53 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Sun, 3 Nov 2024 11:53:53 +0000 (11:53 +0000)
Patch by Mizuki ISHIKAWA (user:ishikawa999).

git-svn-id: https://svn.redmine.org/redmine/trunk@23186 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/project_query_test.rb

index 2929d8e6f328e44facee3a57667705551e8538ed..360bc08b71baeb7e934bd5d839728d53b8b6319e 100644 (file)
@@ -26,7 +26,8 @@ class ProjectQueryTest < ActiveSupport::TestCase
            :groups_users,
            :enabled_modules,
            :custom_fields, :custom_values,
-           :queries
+           :queries,
+           :issues, :journals, :journal_details
 
   include Redmine::I18n
 
@@ -149,4 +150,16 @@ class ProjectQueryTest < ActiveSupport::TestCase
     q.admin_projects = 1
     assert_equal Project.all, q.base_scope
   end
+
+  def test_results_scope_has_last_activity_date
+    q = ProjectQuery.generate!(column_names: [:last_activity_date])
+    result_projects = q.results_scope({})
+
+    assert_kind_of ActiveRecord::Relation, result_projects
+    assert_equal Project, result_projects.klass
+
+    last_activitiy_date = result_projects.find{|p| p.id == 1}.instance_variable_get(:@last_activity_date)
+    assert_not_nil last_activitiy_date
+    assert_equal Redmine::Activity::Fetcher.new(User.current).events(nil, nil, :project => Project.find(1)).first.updated_on, last_activitiy_date
+  end
 end