Project

General

Profile

Defect #36059 » 36059.patch

Yuichi HARADA, 2022-02-10 02:42

View differences:

app/models/time_entry.rb
belongs_to :activity, :class_name => 'TimeEntryActivity'
acts_as_customizable
acts_as_searchable :columns => ['comments'],
:preload => [:project, :issue]
acts_as_event(
:title =>
Proc.new do |o|
lib/redmine/preparation.rb
Search.map do |search|
search.register :issues
search.register :time_entries
search.register :news
search.register :documents
search.register :changesets
test/functional/search_controller_test.rb
:workflows,
:custom_fields, :custom_values,
:custom_fields_projects, :custom_fields_trackers,
:repositories, :changesets
:repositories, :changesets,
:time_entries
def setup
User.current = nil
......
end
def test_search_all_projects
with_settings :default_language => 'en' do
time_entry = TimeEntry.find(5)
time_entry.project_id = 3
time_entry.issue_id = 5
time_entry.comments = 'Time spent on a subproject of eCookbook'
time_entry.save!
with_settings :default_language => 'en', :search_results_per_page => '25', :timespan_format => 'decimal' do
get :index, :params => {:q => 'recipe subproject commit', :all_words => ''}
end
assert_response :success
......
assert_select 'dt.issue a', :text => /Add ingredients categories/
assert_select 'dd', :text => /should be classified by categories/
assert_select 'dt.time-entry:nth-of-type(1)' do
assert_select 'a', text: /7.65 hours \(Bug #5/
assert_select '+ dd', text: /Time spent on a subproject of eCookbook/
end
end
assert_select '#search-results-counts' do
assert_select 'a', :text => 'Changesets (5)'
assert_select 'a[href*=?]', 'changesets=1', :text => 'Changesets (5)'
assert_select 'a[href*=?]', 'time_entries=1', :text => 'Spent time (2)'
end
end
(2-2/2)