Top Level Namespace

Defined Under Namespace

Modules: Hyperion

Constant Summary collapse

BUCKETS =
['testing', 'other_testing', 'account', 'shirt']

Instance Method Summary collapse

Instance Method Details

#empty_buckets(ds) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/hyperion/riak/spec_helper.rb', line 7

def empty_buckets(ds)
  client = ds.instance_variable_get(:@client)
  BUCKETS.each do |bucket_name|
    bucket_name = ds.send(:bucket_name, bucket_name)
    bucket = client.bucket(bucket_name)
    bucket.get_index('$bucket', bucket_name).each do |key|
      bucket.delete(key)
    end
  end
end

#test_app_nameObject



1
2
3
# File 'lib/hyperion/riak/spec_helper.rb', line 1

def test_app_name
  '_HTEST_'
end

#with_testable_riak_datastoreObject



18
19
20
21
22
23
24
25
26
# File 'lib/hyperion/riak/spec_helper.rb', line 18

def with_testable_riak_datastore
  ds = Hyperion.new_datastore(:riak, :app => test_app_name, :protocol => :pbc)
  around :each do |example|
    Hyperion.datastore = ds
    example.run
    empty_buckets(ds)
    Hyperion.datastore = nil
  end
end