Skip to content

Commit

Permalink
Add Atom tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leenagupte committed Sep 24, 2024
1 parent 7f2c881 commit dbf66da
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions spec/system/travel_advice_atom_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,29 @@
expect(page).to have_xpath(".//feed/entry", count: 20)
end
end

context "individual country feed" do
it "displays a country as an atom feed" do
content_store_response = GovukSchemas::Example.find("travel_advice", example_name: "full-country")
base_path = content_store_response.fetch("base_path")
stub_content_store_has_item(base_path, content_store_response)

visit "#{base_path}.atom"

expect(page.status_code).to eq(200)
expect(page).to have_xpath(".//feed/id", text: "http://www.dev.gov.uk#{base_path}")
expect(page).to have_xpath(".//feed/title", text: "Travel Advice Summary")
expect(page).to have_xpath(".//feed/updated", text: "2017-02-14T15:42:21+00:00")
expect(page).to have_xpath(".//feed/link[@rel='self' and @href='http://www.example.com#{base_path}.atom']")
expect(page).to have_xpath(".//feed/link[@rel='alternate' and @type='text/html' and @href='http://www.dev.gov.uk#{base_path}']")
expect(page).to have_xpath(".//feed/author/name", text: "GOV.UK")
expect(page).to have_xpath(".//feed/entry", count: 1)
expect(page).to have_xpath(".//feed/entry[1]/id", text: "http://www.dev.gov.uk#{base_path}##{Time.zone.parse(content_store_response['public_updated_at'])}")
expect(page).to have_xpath(".//feed/entry[1]/title", text: (content_store_response["title"]).to_s)
expect(page).to have_xpath(".//feed/entry[1]/updated", text: "2017-02-14T15:42:21+00:00")
expect(page).to have_xpath(".//feed/entry[1]/link[@type='text/html' and @href='http://www.dev.gov.uk#{base_path}']")
expect(page).to have_xpath(".//feed/entry[1]/link[@type='application/atom+xml' and @href='http://www.dev.gov.uk#{base_path}.atom']")
expect(page).to have_xpath(".//feed/entry[1]/summary[@type='xhtml']/div/p", text: (content_store_response["change_description"]).to_s)
end
end
end

0 comments on commit dbf66da

Please sign in to comment.