Sha256: a42746582101a176cb86d53cad4a3e099be193371c357d4edaebf88e0aa8808a

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

require 'spec_helper'

describe EbisuConnection::SlaveGroup do
  before(:all) do
    @sg = EbisuConnection::SlaveGroup
  end

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

    it "return slve instance object" do
      inst = @sg.new(["h"], "slave")
      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"], "slave")
      c = inst.sample.connection
      expect {
        inst.remove_connection(c)
      }.to raise_error(EbisuConnection::SlaveGroup::AllSlavesHasGoneError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ebisu_connection-0.3.0 spec/unit/slave_group_spec.rb