Sha256: 4f776e9910202eba8a5fe9159a1ab8efd5116aaefbcde78c910f9890c670fda8

Contents?: true

Size: 970 Bytes

Versions: 2

Compression:

Stored size: 970 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"

    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

2 entries across 2 versions & 1 rubygems

Version Path
rico-0.3.0 spec/spec_helper.rb
rico-0.2.0 spec/spec_helper.rb