Implement alerts index
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user