Initial work
This commit is contained in:
@@ -354,26 +354,6 @@ describe Browser do
|
||||
#end
|
||||
end
|
||||
|
||||
describe '#Browser.generate_cache_key_from_request' do
|
||||
it '2 requests with the same url, without params must have the same cache_key' do
|
||||
|
||||
url = 'http://example.com'
|
||||
key1 = Browser.generate_cache_key_from_request(@browser.forge_request(url))
|
||||
key2 = Browser.generate_cache_key_from_request(@browser.forge_request(url))
|
||||
|
||||
key1.should === key2
|
||||
end
|
||||
|
||||
it '2 requests with the same url, but with different params should have a different cache_key' do
|
||||
|
||||
url = 'http://example.com'
|
||||
key1 = Browser.generate_cache_key_from_request(@browser.forge_request(url, params: { login: 'master', password: 'it\'s me !' }))
|
||||
key2 = Browser.generate_cache_key_from_request(@browser.forge_request(url))
|
||||
|
||||
key1.should_not == key2
|
||||
end
|
||||
end
|
||||
|
||||
describe 'testing caching' do
|
||||
it 'should only do 1 request, and retrieve the other one from the cache' do
|
||||
|
||||
|
||||
@@ -61,17 +61,17 @@ describe CacheFileStore do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#read_entry (nonexistent entry)' do
|
||||
describe '#get (nonexistent entry)' do
|
||||
it 'should return nil' do
|
||||
@cache.read_entry(Digest::SHA1.hexdigest('hello world')).should be_nil
|
||||
@cache.get(Digest::SHA1.hexdigest('hello world')).should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe '#write_entry, #read_entry' do
|
||||
describe '#set, #get' do
|
||||
|
||||
after :each do
|
||||
@cache.write_entry(@key, @data, @timeout)
|
||||
@cache.read_entry(@key).should === @expected
|
||||
@cache.set(@key, @data, @timeout)
|
||||
@cache.get(@key).should === @expected
|
||||
end
|
||||
|
||||
it 'should get the correct entry (string)' do
|
||||
|
||||
@@ -27,7 +27,7 @@ end
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../lib/common/common_helper')
|
||||
|
||||
gem 'webmock', '=1.8.11'
|
||||
#gem 'webmock', '=1.8.11'
|
||||
require 'webmock/rspec'
|
||||
|
||||
SPEC_DIR = ROOT_DIR + '/spec'
|
||||
|
||||
Reference in New Issue
Block a user