Sha256: 27e75bce466c9d14e5d862e63f619a28810413f6e2672d0572a74c74ef5ecca0

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

require 'minitest/autorun'
require 'mocha'
require 'couchbase'
require 'yajl'

class MiniTest::Unit::TestCase
  # retry block +attempts+ times and fail if time is out
  def assert_operation_completed(attempts = 10)
    timeout = 1
    attempts.times do
      sleep(timeout)
      return if yield
      timeout *= 2
    end
    flunk "Time is out!"
  end

  # fetch list of databases and check if all vbuckets database ready
  def database_ready(bucket)
    all_dbs_uri = bucket.next_node.couch_api_base.sub(bucket.name, '_all_dbs')
    bucket.http_get(all_dbs_uri).grep(/#{bucket.name}\/\d+/).size == bucket.vbuckets.size
  end

  def json_fixture(path, options = {})
    data = File.read(File.join(File.dirname(__FILE__), 'support', path))
    options[:raw] ? data : Yajl::Parser.parse(data)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couchbase-0.9.8 test/setup.rb
couchbase-0.9.7 test/setup.rb