Sha256: 9f22993b6e67f61439097b82ade360f659d03ecf65760890b190d3951d43e463
Contents?: true
Size: 958 Bytes
Versions: 4
Compression:
Stored size: 958 Bytes
Contents
require 'rest-core/test' describe RC::DalliExtension do after do Muack.verify end def engine env yield(env.merge(RC::RESPONSE_STATUS => 200, RC::RESPONSE_HEADERS => {'A' => 'B'}, RC::RESPONSE_BODY => 'ok')) end def call dalli, opts={}, &block dalli.extend(RC::DalliExtension) RC::Cache.new(method(:engine), dalli, 10). call({RC::REQUEST_METHOD => :get, RC::REQUEST_HEADERS => {}}.merge(opts), &lambda{|_|_})[RC::RESPONSE_BODY] end would 'set and get' do dalli = Object.new mock(dalli).set(is_a(String), nil) do |key, value| mock(dalli).get(key){ "200\nA: B\n\n\nok" } end expect(call(dalli, 'cache.update' => true)).eq 'ok' end would 'store' do dalli = Object.new mock(dalli).get(is_a(String)) do |key| mock(dalli).set(key, "200\nA: B\n\n\nok", 10){} nil end expect(call(dalli)).eq 'ok' end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rest-core-4.0.1 | test/test_dalli_extension.rb |
rest-core-4.0.0 | test/test_dalli_extension.rb |
rest-core-3.6.0 | test/test_dalli_extension.rb |
rest-core-3.5.92 | test/test_dalli_extension.rb |