-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up to: Add alert statuses to TravelAdvice model
- Loading branch information
1 parent
759bf03
commit 24854fe
Showing
2 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
RSpec.describe TravelAdvice do | ||
before do | ||
@content_store_response = GovukSchemas::Example.find("travel_advice", example_name: "full-country") | ||
@base_path = @content_store_response.fetch("base_path") | ||
end | ||
|
||
describe "#alert_status" do | ||
it "adds allowed statuses" do | ||
@content_store_response["details"]["alert_status"] = [described_class::ALERT_STATUSES.first] | ||
|
||
alert_statuses = described_class.new(@content_store_response).alert_status | ||
expect(alert_statuses).to eq([described_class::ALERT_STATUSES.first]) | ||
end | ||
|
||
it "removes unexpected statuses" do | ||
@content_store_response["details"]["alert_status"] = %w[unexpected-status] | ||
|
||
alert_statuses = described_class.new(@content_store_response).alert_status | ||
expect(alert_statuses).to be_empty | ||
end | ||
end | ||
end |