Permalink
Browse files

fixing a failing test on zlib support. change Easy#method= to set the…

… method to allow for custom commands
  • Loading branch information...
1 parent 9c30329 commit e5b30a20c89a52cd952d57ba268995fe41894aec @ryana ryana committed Jun 23, 2010
Showing with 10 additions and 2 deletions.
  1. +2 −2 lib/typhoeus/easy.rb
  2. +8 −0 spec/typhoeus/easy_spec.rb
View
@@ -105,7 +105,7 @@ def timed_out?
end
def supports_zlib?
- @supports_zlib ||= !!(version.match(/zlib/))
+ @supports_zlib = !!(version.match(/zlib/))
end
def request_body=(request_body)
@@ -145,7 +145,7 @@ def method=(method)
elsif method == :head
set_option(OPTION_VALUES[:CURLOPT_NOBODY], 1)
else
- set_option(OPTION_VALUES[:CURLOPT_CUSTOMREQUEST], "DELETE")
+ set_option(OPTION_VALUES[:CURLOPT_CUSTOMREQUEST], method.to_s.upcase)
end
end
@@ -117,6 +117,14 @@
end
end
+ describe "purge" do
+ it "should set custom request to purge" do
+ easy = Typhoeus::Easy.new
+ easy.should_receive(:set_option).with(Typhoeus::Easy::OPTION_VALUES[:CURLOPT_CUSTOMREQUEST], "PURGE").once
+ easy.method = :purge
+ end
+ end
+
describe "head" do
it "should perform a head" do
easy = Typhoeus::Easy.new

0 comments on commit e5b30a2

Please sign in to comment.