Sha256: 2d384424a520f2d7bf5b4b54792a641edfc95a01d9fda7817c55f0ea803c9510

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'helper'

class TestConfiguration < Minitest::Test

  SINGLE_CONFIG = {
    host: '127.0.0.1',
    bucket: 'fu',
    password: 'abc123'
  }

  MULTIPLE_HOSTS = {
    hosts: %w(host1 host2),
    bucket: 'bar',
    password: 'abc123'
  }

  MULTIPLE_BUCKETS = {
    host: '127.0.0.1',
    buckets: [
      { 'name' => 'fu',  'password' => 'abc123' },
      { 'name' => 'bar', 'password' => 'abc123' }
    ]
  }

  def test_default
    config = Couchbase::Configuration.new
    assert_equal ['localhost'], config.hosts
    assert_equal 'default', config.buckets.first.name
  end

  def test_single_config
    config = Couchbase::Configuration.new(SINGLE_CONFIG)
    assert_equal ['127.0.0.1'], config.hosts
    assert_equal 'fu', config.buckets.first.name
    assert_equal 'abc123', config.buckets.first.password
  end

  def test_multiple_hosts
    config = Couchbase::Configuration.new(MULTIPLE_HOSTS)
    assert_equal %w(host1 host2), config.hosts
    assert_equal 'bar', config.buckets[0].name
    assert_equal 'abc123', config.buckets[0].password
  end

  def test_multiple_buckets
    config = Couchbase::Configuration.new(MULTIPLE_BUCKETS)
    assert_equal ['127.0.0.1'], config.hosts
    assert_equal 'fu', config.buckets[0].name
    assert_equal 'bar', config.buckets[1].name
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
couchbase-jruby-client-1.0.4-java test/test_configuration.rb