Implement alerts index

This commit is contained in:
2025-10-08 00:43:03 -07:00
parent 4c3ddc6175
commit 832164ead2
4 changed files with 23 additions and 3 deletions

View File

@@ -2,6 +2,21 @@ require 'rails_helper'
RSpec.describe "Api::V1::Parks::Alerts", type: :request do
describe "GET /parks/:code/alerts" do
pending "add some examples (or delete) #{__FILE__}"
it "returns the alerts associated to a park" do
get api_v1_park_alerts_url(parks(:one).code)
expect(response).to have_http_status(:success)
expect(response.parsed_body.count).to eq(1)
expect(response.parsed_body).to include(
hash_including(
:description, park_code: "crla", title: "Fire Restrictions in Effect",
category: "caution", indexed_date: "2025-07-04T22:07:59.000Z"
)
)
end
it "returns :not_found for unknown parks" do
get api_v1_park_alerts_url("foo")
expect(response).to have_http_status(:not_found)
end
end
end

View File

@@ -42,7 +42,7 @@ RSpec.describe "Api::V1::Parks", type: :request do
end
it "returns the park" do
get api_v1_park_url("crla")
get api_v1_park_url(parks(:one).code)
expect(response).to have_http_status(:success)
expect(response.parsed_body).to match(
hash_including(