Sha256: a1ec1b56f04c6b5ecd7e7947a0c63795a7409d630b91249ada85808e70de4b96

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

require 'spec_helper'

describe EbisuConnection::SlaveGroup do
  before(:all) do
    @sg = EbisuConnection::SlaveGroup
    @spec = {
      "adapter" => "mysql2",
      "database" => "ebisu_connection_test",
      "username" => "root"
    }
  end

  context "#sample" do
    it "raise exception if slaves empty" do
      inst = @sg.new([], {})
      expect{
        inst.sample
      }.to raise_error(EbisuConnection::SlaveGroup::AllSlavesHasGoneError)
    end

    it "return slve instance object" do
      inst = @sg.new(["h"], {})
      expect(inst.sample).to be_a(EbisuConnection::Slave)
    end
  end

  context "#remove_connection" do
    it "raise exception AllSlavesHasGoneError when slaves size is one" do
      inst = @sg.new(["localhost"], @spec)
      c = inst.sample.connection
      expect {
        inst.remove_connection(c)
      }.to raise_error(EbisuConnection::SlaveGroup::AllSlavesHasGoneError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ebisu_connection-0.2.0 spec/unit/slave_group_spec.rb
ebisu_connection-0.1.1 spec/unit/slave_group_spec.rb
ebisu_connection-0.1.0 spec/unit/slave_group_spec.rb