Hello everyone,
Someone I was pairing with this evening needed this for one of their
projects, so I’ve added matchers for headers to rspec-http and pushed
an updated gem. You can now do
response.should have_header(‘Content-Type’)
response.should have_header(‘Content-Type’ => ‘application/json’)
response.should have_header(‘Content-Type’ => /json/)
More info at GitHub - c42/rspec-http: RSpec HTTP is an extension library that makes it easier to write specs for HTTP/REST APIs
As always, I’d love to hear any feedback you may have.
Best,
Sidu.
http://c42.in