Permalink
Browse files

arghhh... stupid me

  • Loading branch information...
1 parent ba03f65 commit ca6a7616488addc959477b31894085fa37d50633 @godfat godfat committed Jul 18, 2012
Showing with 15 additions and 2 deletions.
  1. +2 −2 lib/rest-core/middleware/cache.rb
  2. +13 −0 test/test_cache.rb
View
4 lib/rest-core/middleware/cache.rb
@@ -72,8 +72,8 @@ def process_wrapped res, res_wrapped
end
def cache_for res
- return response unless cache(res)
- return response unless cache_for?(res)
+ return res unless cache(res)
+ return res unless cache_for?(res)
if expires_in(res).kind_of?(Fixnum) &&
cache(res).respond_to?(:store) &&
View
13 test/test_cache.rb
@@ -39,6 +39,19 @@ def call env
c.request({RC::REQUEST_PATH => '/'}, RC::RESPONSE_STATUS).should.eq 200
end
+ should 'no cache' do
+ path = 'http://a'
+ stub_request(:get , path).to_return(:body => 'OK')
+ stub_request(:post, path).to_return(:body => 'OK')
+ c = RC::Builder.client do
+ use RC::Cache, nil, nil
+ end
+
+ c.new . get(path) .should.eq('OK')
+ c.new(:cache => (h={})).post(path).should.eq('OK')
+ h.should.eq({})
+ end
+
should 'head then get' do
c = RC::Builder.client do
use RC::Cache, {}, nil

0 comments on commit ca6a761

Please sign in to comment.