Skip to content

Commit 6772e7f

Browse files
committed
Strengthen XML error feed spec
1 parent 2a14aae commit 6772e7f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

spec/html2rss/web/app_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,14 @@ def app = described_class
156156
end
157157

158158
it 'renders XML error when static feed generation fails' do
159-
allow(Html2rss::Web::XmlBuilder).to receive(:build_error_feed).and_return('<error/>')
160-
161159
get '/missing-feed'
160+
xml = Nokogiri::XML(last_response.body)
162161

163162
expect(last_response.status).to eq(404)
164163
expect(last_response.headers['Content-Type']).to eq('application/xml')
165-
expect(last_response.body).to eq('<error/>')
164+
expect(xml.at_xpath('/rss/channel/title')&.text).to eq('Error')
165+
expect(xml.at_xpath('/rss/channel/description')&.text)
166+
.to eq("Failed to generate feed: Feed 'missing-feed' is not available on this instance")
166167
end
167168

168169
it 'renders JSON Feed-shaped errors when static json feed generation fails' do

0 commit comments

Comments
 (0)