Sha256: 317bffe46269f1e98c922264c37c151707e8a19ab6c7f609d13a363068ab967b
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
if respond_to?(:require_relative, true) require_relative 'common' else require File.dirname(__FILE__) + '/common' end describe RestGraph do after do reset_webmock RR.verify end it 'would enable cache if passing cache' do url, body = "https://graph.facebook.com/cache", '{"message":"ok"}' stub_request(:get, url).to_return(:body => body).times(1) cache = {} rg = RestGraph.new(:cache => cache, :auto_decode => false) 3.times{ rg.get('cache').should == body } cache.should == {rg.send(:cache_key, url) => body} end it 'would not cache post/put/delete' do [:put, :post, :delete].each{ |meth| url, body = "https://graph.facebook.com/cache", '{"message":"ok"}' stub_request(meth, url).to_return(:body => body).times(3) cache = {} rg = RestGraph.new(:cache => cache) 3.times{ if meth == :delete rg.send(meth, 'cache').should == {'message' => 'ok'} else rg.send(meth, 'cache', 'payload').should == {'message' => 'ok'} end } cache.should == {} } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rest-graph-1.5.0 | test/test_cache.rb |
rest-graph-1.4.6 | test/test_cache.rb |