spec/support/matchers.rb in httpi-0.9.2 vs spec/support/matchers.rb in httpi-0.9.3
- old
+ new
@@ -1,11 +1,19 @@
RSpec::Matchers.define :match_response do |options|
- defaults = { :code => 200, :headers => {}, :body => "" }
+ defaults = { :code => 200, :headers => { "Accept-encoding" => "utf-8" }, :body => "" }
response = defaults.merge options
-
+
match do |actual|
actual.should be_an(HTTPI::Response)
actual.code.should == response[:code]
- actual.headers.should == response[:headers]
+ downcase(actual.headers).should == downcase(response[:headers])
actual.body.should == response[:body]
end
+
+ def downcase(hash)
+ hash.inject({}) do |memo, (key, value)|
+ memo[key.downcase] = value.downcase
+ memo
+ end
+ end
+
end