lib/cucumber/nagios/steps/http_header_steps.rb in cucumber-nagios-0.8.3 vs lib/cucumber/nagios/steps/http_header_steps.rb in cucumber-nagios-0.8.4

- old
+ new

@@ -1,21 +1,20 @@ -When /I fetch (.*)/ do | url | - visit url - @url_headers = response.header +When /I fetch headers from "(.*)"/ do |url| + visit(url) + @headers = response.header end - -Then /^the "(.*)" header should be "(.*)"$/ do | header_name, header_value| - @url_headers[header_name].should == header_value + +Then /^the "(.*)" header should be "(.*)"$/ do |name, value| + @headers[name].should == value end - -Then /^the response should contain the "(.*)" header$/ do | header_name | - @url_headers.should have_key(header_name.downcase) + +Then /^the response should contain the "(.*)" header$/ do |name| + @headers.should have_key(name.downcase) end - -### header contains checks -Then /^the "(.*)" header should contain "(.*)"$/ do | header_name, header_contains | - @url_headers[header_name].should match header_contains + +Then /^the "(.*)" header should contain "(.*)"$/ do |name, expression| + @headers[name].should match(expression) end - -Then /^the "(.*)" header should not contain "(.*)"$/ do | header_name, header_contains | - @url_headers[header_name].should_not match header_contains + +Then /^the "(.*)" header should not contain "(.*)"$/ do |name, expression| + @headers[name].should_not match(expression) end