Add pagination to alerts index
This commit is contained in:
15
spec/fixtures/alerts.yml
vendored
Normal file
15
spec/fixtures/alerts.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
park_code: crla
|
||||
title: Fire Restrictions in Effect
|
||||
description: To ensure public safety and to provide the highest degree of protection to park resources, fire restrictions are in effect until further notice.
|
||||
category: caution
|
||||
indexed_date: 2025-07-04 22:07:59.0
|
||||
|
||||
two:
|
||||
park_code: olym
|
||||
title: Roads May Be Icy - Please Use Caution!
|
||||
description: Even though the sun is shining, the open roads in the park may still have icy patches, especially in the mornings and evenings when the temperatures drop. Please drive with caution.
|
||||
category: caution
|
||||
indexed_date: 2025-04-30 23:40:30.0
|
||||
15
spec/models/park_spec.rb
Normal file
15
spec/models/park_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Park, type: :model do
|
||||
describe "#alerts" do
|
||||
it "has alerts" do
|
||||
expect(parks(:one).alerts).to eq([alerts(:one)])
|
||||
end
|
||||
|
||||
it "destroys dependent alerts" do
|
||||
expect do
|
||||
parks(:one).destroy!
|
||||
end.to change(Alert, :count).by(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user