Skip to content

Commit

Permalink
Add spec for API catalogue
Browse files Browse the repository at this point in the history
  • Loading branch information
odlp committed Sep 28, 2020
1 parent 3a1aa1b commit e3b7079
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/lib/api_catalogue_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require "api_catalogue"

RSpec.describe ApiCatalogue, "::from_csv" do
let(:csv_path) { File.expand_path("../../data/inputs/apic.csv", __dir__) }

it "parses the CSV source" do
api_catalogue = described_class.from_csv(csv_path)

expect(api_catalogue.organisations_apis.size).to be > 10

gds, gds_apis = api_catalogue.organisations_apis.detect do |org, _|
org.name.casecmp?("Government Digital Service")
end

notify_api = gds_apis.detect do |api|
api.name.casecmp?("GOV.UK Notify")
end

expect(gds).to have_attributes(
name: "Government Digital Service",
alternate_name: "GDS",
)

expect(notify_api).to have_attributes(
name: "GOV.UK Notify",
description: be_present,
url: "https://api.notifications.service.gov.uk/",
)
end
end

0 comments on commit e3b7079

Please sign in to comment.