The step definitions below allow you to write this in both Webrat and Capybara:
When I follow "Download as PDF"
Then I should get a response with content-type "application/pdf"
Capybara
Then /^I should get a response with content-type "([^"]*)"$/ do |content_type|
page.response_headers['Content-Type'].should == content_type
end
Webrat
Then /^I should get a response with content-type "([^"]*)"$/ do |content_type|
response.content_type.should == content_type
end
Unfortunatly this does not work with the Selenium webdriver.
Posted by Henning Koch to makandra dev (2010-12-30 13:57)