Project

General

Profile

Patch #41678 » add-test.patch

Mizuki ISHIKAWA, 2024-11-03 08:40

View differences:

test/unit/project_query_test.rb
26 26
           :groups_users,
27 27
           :enabled_modules,
28 28
           :custom_fields, :custom_values,
29
           :queries
29
           :queries,
30
           :issues, :journals, :journal_details
30 31

  
31 32
  include Redmine::I18n
32 33

  
......
149 150
    q.admin_projects = 1
150 151
    assert_equal Project.all, q.base_scope
151 152
  end
153

  
154
  def test_results_scope_has_last_activity_date
155
    q = ProjectQuery.generate!(column_names: [:last_activity_date])
156
    result_projects = q.results_scope({})
157

  
158
    assert_kind_of ActiveRecord::Relation, result_projects
159
    assert_equal Project, result_projects.klass
160

  
161
    last_activitiy_date = result_projects.find{|p| p.id == 1}.instance_variable_get(:@last_activity_date)
162
    assert_not_nil last_activitiy_date
163
    assert_equal Redmine::Activity::Fetcher.new(User.current).events(nil, nil, :project => Project.find(1)).first.updated_on, last_activitiy_date
164
  end
152 165
end
(2-2/2)