Files
national-parks-api/spec/requests/api/v1/parks/alerts_spec.rb
2025-10-08 00:43:03 -07:00

23 lines
742 B
Ruby

require 'rails_helper'
RSpec.describe "Api::V1::Parks::Alerts", type: :request do
describe "GET /parks/:code/alerts" do
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