Skip to content

Instantly share code, notes, and snippets.

@deanwilson
Created March 31, 2010 13:19
Show Gist options
  • Save deanwilson/350295 to your computer and use it in GitHub Desktop.
Save deanwilson/350295 to your computer and use it in GitHub Desktop.
Feature: http://www.unixdaemon.net/ response headers
Scenario: Server header should be production quality
When I fetch http://www.unixdaemon.net/
Then the "Server" header should be "Apache"
Scenario: Response header should contain an Etag
When I fetch http://www.unixdaemon.net/
Then the response should contain the "Etag" header
Scenario: The Content-Type header should contain text/html
When I fetch http://www.unixdaemon.net/
Then the "Content-Type" header should contain "text/html"
Scenario: The Content-Type header should not contain text/xml
When I fetch http://www.unixdaemon.net/
Then the "Content-Type" header should not contain "text/xml"
When /I fetch (.*)/ do | url |
visit url
@url_headers = response.header
end
Then /^the "(.*)" header should be "(.*)"$/ do | header_name, header_value|
@url_headers[header_name].should == header_value
end
Then /^the response should contain the "(.*)" header$/ do | header_name |
@url_headers.should have_key(header_name.downcase)
end
### header contains checks
Then /^the "(.*)" header should contain "(.*)"$/ do | header_name, header_contains |
@url_headers[header_name].should match header_contains
end
Then /^the "(.*)" header should not contain "(.*)"$/ do | header_name, header_contains |
@url_headers[header_name].should_not match header_contains
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment