Project

General

Profile

« Previous | Next » 

Revision d5f2f1de

Added by Amir Fefer almost 6 years ago

Fixes #23599 - fix subtotal value in API call with thin=true

View differences:

test/controllers/api/v2/hosts_controller_test.rb
assert_equal Host.all.pluck(:id, :name), hosts['results'].map(&:values)
end
test "subtotal should be the same as the search count with thin" do
FactoryBot.create_list(:host, 2)
Host.last.update_attribute(:name, 'test')
get :index, params: { thin: true, per_page: 1, search: 'host' }
assert_response :success
assert_not_nil assigns(:hosts)
hosts = ActiveSupport::JSON.decode(@response.body)
assert_equal hosts['subtotal'], Host.search_for('host').size
end
test "should include registered scope on index" do
# remember the previous state
old_scopes = Api::V2::HostsController.scopes_for(:index).dup

Also available in: Unified diff