diff --git a/spec/system/travel_advice_atom_spec.rb b/spec/system/travel_advice_atom_spec.rb index eb0641be7e..6c8a5916bb 100644 --- a/spec/system/travel_advice_atom_spec.rb +++ b/spec/system/travel_advice_atom_spec.rb @@ -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