test/esp/resources/dashboard_test.rb in esp_sdk-2.6.0 vs test/esp/resources/dashboard_test.rb in esp_sdk-2.7.0

- old
+ new

@@ -45,15 +45,28 @@ end end context '.recent' do should 'call the api and return an array of dashboard objects' do - stubbed_dashboard = stub_request(:get, %r{dashboard/recent.json*}).to_return(body: json_list(:dashboard, 2)) + stubbed_dashboard = stub_request(:put, %r{dashboard/recent*}).to_return(body: json_list(:dashboard, 2)) dashboard = ESP::Dashboard.recent assert_requested(stubbed_dashboard) assert_equal ESP::Dashboard, dashboard.resource_class + end + + context 'next_page' do + should 'request page 2 when multiple dashboards' do + stub_dashboard = stub_request(:put, %r{dashboard/recent*}).with(body: {}.to_json).to_return(body: json_list(:dashboard, 25)) + stub_dashboard2 = stub_request(:put, %r{dashboard/recent*}).with(body: { filter: {}, page: { number: '2', size: '20' } }.to_json).to_return(body: json_list(:stat, 2)) + + dashboard = ESP::Dashboard.recent + dashboard.next_page + + assert_requested(stub_dashboard) + assert_requested(stub_dashboard2) + end end end end end end