Sha256: 24150d81babba353a00b543239247b7afc13e7c6e2198a5e3cc029ccda68dcf7
Contents?: true
Size: 852 Bytes
Versions: 4
Compression:
Stored size: 852 Bytes
Contents
require './lib/couchpillow.rb' require 'minitest/autorun' require 'minitest/unit' require 'mocha/mini_test' class FakeCouchbaseServer def initialize @storage = {} @cas = {} end def set id, data, opts = {} raise Couchbase::Error::KeyExists if @storage.has_key?(id) && opts[:cas] && @cas[id] != opts[:cas] @storage[id] = data @cas[id] = SecureRandom.hex(8) end def delete id @storage.delete(id) @cas.delete(id) end def replace id, data, opts = {} raise "Document does not exist" unless @storage.has_key?(id) raise Couchbase::Error::KeyExists if @storage.has_key?(id) && opts[:cas] && @cas[id] != opts[:cas] @storage[id] = data @cas[id] = SecureRandom.hex(8) end def get id, opts = {} return [@storage[id], nil, @cas[id]] if opts[:extended] == true @storage[id] end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
couchpillow-0.4.8 | test/helper.rb |
couchpillow-0.4.7 | test/helper.rb |
couchpillow-0.4.6 | test/helper.rb |
couchpillow-0.4.5 | test/helper.rb |