order_option << "#{Project.table_name}.lft ASC"
scope = base_scope.
order(order_option).
- joins(joins_for_order_statement(order_option.join(',')))
+ joins(joins_for_order_statement(order_option.join(','))).
+ limit(options[:limit]).
+ offset(options[:offset])
if has_custom_field_column?
scope = scope.preload(:custom_values)
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
+
+ def test_results_scope_with_offset_and_limit
+ q = ProjectQuery.new
+
+ ((q.results_scope.count / 2) + 1).times do |i|
+ limit = 2
+ offset = i * 2
+
+ scope_without = q.results_scope.offset(offset).limit(limit).ids
+ scope_with = q.results_scope(:offset => offset, :limit => limit).ids
+
+ assert_equal scope_without, scope_with
+ end
+ end
end