typhoeus 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ require 'typhoeus/request'
14
14
  require 'typhoeus/hydra'
15
15
 
16
16
  module Typhoeus
17
- VERSION = "0.1.23"
17
+ VERSION = "0.1.24"
18
18
 
19
19
  def self.easy_object_pool
20
20
  @easy_objects ||= []
@@ -23,6 +23,11 @@ module Typhoeus
23
23
  @hydra = val
24
24
  end
25
25
 
26
+ def clear_cache_callbacks
27
+ @cache_setter = nil
28
+ @cache_getter = nil
29
+ end
30
+
26
31
  def clear_stubs
27
32
  @stubs = []
28
33
  end
@@ -35,5 +35,13 @@ module Typhoeus
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ def success?
40
+ @code >= 200 && @code < 300
41
+ end
42
+
43
+ def modified?
44
+ @code != 304
45
+ end
38
46
  end
39
47
  end
@@ -48,4 +48,16 @@ describe Typhoeus::Response do
48
48
  response.headers_hash["Set-Cookie"].should include("_session=BAh7CToPc2Vzc2lvbl9pZCIlZTQzMDQzMDg1YjI3MTQ4MzAzMTZmMWZmMWJjMTU1NmI6CWNhcnQiJThmZGQ2YTgyOGQ5Yzg5YTczN2E1MjY2OGJlMGNlYmFmOgZyIgA6BnMiDi9jYXJ0L2FkZA%3D%3D--6b0a699625caed9597580d8e9b6ca5f5e5954125; path=/; HttpOnly")
49
49
  end
50
50
  end
51
+
52
+ describe "status checking" do
53
+ it "is successful if response code is 200-299" do
54
+ Typhoeus::Response.new(:code => 220).success?.should be
55
+ Typhoeus::Response.new(:code => 400).success?.should_not be
56
+ end
57
+
58
+ it "is not modified if the status code is 304" do
59
+ Typhoeus::Response.new(:code => 304).modified?.should_not be
60
+ Typhoeus::Response.new(:code => 200).modified?.should be
61
+ end
62
+ end
51
63
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 23
9
- version: 0.1.23
8
+ - 24
9
+ version: 0.1.24
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paul Dix