Sha256: f0dadffe748441ea9dd3e1c4a229134905141aed15e0ff002ef5e2f0b22bef6d

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require "rubygems"
require "rico"

module RiakHelpers
  def self.bucket
    "rico_test"
  end

  def self.reset!
    Rico.namespace = "test"
    Rico.riak = Riak::Client.new(http_port: 8091)

    Riak.disable_list_keys_warnings = true
    b = Rico.bucket(bucket)
    b.keys.each do |k|
      b.delete k
    end

    a = Rico::Array.new bucket, "visual_array"
    a.add 1,2,3,4,5,6
    a.remove 6
  end

  def self.build_conflicted_robject(key, values)
    bucket = Rico.bucket RiakHelpers.bucket
    o = Riak::RObject.new bucket, key
    siblings = values.map do |v|
      x = Riak::RObject.new bucket, key
      x.data = v
      x
    end

    o = Riak::RObject.new bucket, key
    o.siblings = siblings
    o
  end

  def self.build_conflicted_rico_object(klass, key, values=["v1", "v2", "v3"])
    o = build_conflicted_robject key, values
    v = klass.new RiakHelpers.bucket, key
    v.instance_variable_set("@riak_object", o)
    v
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rico-0.1.0 spec/spec_helper.rb