From eac10972026708d85bd20743e6a46b73e1034d88 Mon Sep 17 00:00:00 2001 From: Klaudia Biala Date: Wed, 18 Dec 2024 19:40:01 +0100 Subject: [PATCH] Fix api example --- .../api/v1/ping_times_controller_test.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/controllers/api/v1/ping_times_controller_test.rb b/test/controllers/api/v1/ping_times_controller_test.rb index 96ad08cc1..166c1b215 100644 --- a/test/controllers/api/v1/ping_times_controller_test.rb +++ b/test/controllers/api/v1/ping_times_controller_test.rb @@ -47,12 +47,15 @@ def setup payload: { 'test_key' => 'test_value' }.to_json } # Post the payload - post api_v1_collector_url, - headers: { 'Token' => @user.api_token }, - params: valid_payload - assert_response 202 - json = response_to_json(@response.body) - assert_equal 'Accepted', json['status'] + assert_difference("Collector.count") do + post api_v1_collector_url, + headers: { 'Token' => @user.api_token }, + params: valid_payload + assert_response 202 + json = response_to_json(@response.body) + assert_equal 'Accepted', json['status'] + end + # Verify that the record was saved successfully collector = Collector.last assert_equal 'ping', collector.payload_type