Add stats endpoint
This commit is contained in:
21
spec/requests/api/v1/stats_spec.rb
Normal file
21
spec/requests/api/v1/stats_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Api::V1::Stats", type: :request do
|
||||
describe "GET /stats" do
|
||||
it "returns summary stats" do
|
||||
alerts(:two).update!(park_code: parks(:one).code)
|
||||
|
||||
get api_v1_stats_url
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.parsed_body).to match(
|
||||
park_count: 2,
|
||||
alert_count: 2,
|
||||
most_alerts: {
|
||||
park_code: "crla",
|
||||
alert_count: 2
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user