Sha256: d06fa31fb490a1213e56f7b0f19e628f957ee34c3085b6993c4a1abb705dd5f9
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module TestClient def test_client if defined? $test_client and $test_client.ping return $test_client end candidate_client = Riak::Client.new test_client_configuration live = candidate_client.ping return $test_client = candidate_client if live end def test_client_configuration TestClient.test_client_configuration end def self.test_client_configuration if defined? $test_client_configuration return $test_client_configuration end begin config_path = File.expand_path '../test_client.yml', __FILE__ config = YAML.load_file(config_path).symbolize_keys rescue Errno::ENOENT => ex $stderr.puts("WARNING: could not find file: #{config_path}, exception: #{ex}") config = {} config[:pb_port] = 10017 end if config[:nodes] new_nodes = config[:nodes].map(&:symbolize_keys) config[:nodes] = new_nodes end $test_client_configuration = config end def random_bucket(name = 'test_client') bucket_name = [name, Time.now.to_i, random_key].join('-') test_client.bucket bucket_name end def random_key rand(36**10).to_s(36) end end RSpec.configure do |config| config.include TestClient, test_client: true end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riak-client-2.4.1 | spec/support/test_client.rb |