Sha256: d90be8be0fd2ef8c29b535d46118396584d769fba5bd2f7dc0c4257427362f6b

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'helper'

describe Cassanity::Cql::ReconnectableDriver do
  let(:client) { double('Cql::Client') }

  describe '.connect' do
    it 'constructs a CQL client using the provided options' do
      Cql::Client.should_receive(:connect).with(:foo => "bar") { client }
      driver = described_class.connect(:foo => "bar")
    end
  end

  describe '#disconnect' do
    it 'closes the underlying driver' do
      Cql::Client.stub(:connect => client)
      driver = described_class.connect(:foo => "bar")

      client.should_receive(:close)
      driver.disconnect
    end
  end

  describe '#use' do
    it 'forwards the message to the underlying driver' do
      Cql::Client.stub(:connect => client)
      driver = described_class.connect(:foo => "bar")

      client.should_receive(:use).with("keyspace")
      driver.use("keyspace")
    end
  end

  describe '#execute' do
    it 'forwards the message to the underlying driver' do
      Cql::Client.stub(:connect => client)
      driver = described_class.connect(:foo => "bar")

      client.should_receive(:execute).with("query")
      driver.execute("query")
    end
  end

  describe '#connected?' do
    it 'forwards the message to the underlying driver' do
      Cql::Client.stub(:connect => client)
      driver = described_class.connect(:foo => "bar")

      client.should_receive(:connected?).and_return(true)
      driver.connected?.should be_true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cassanity-0.6.0 spec/unit/cassanity/cql/reconnectable_driver_spec.rb
cassanity-0.6.0.beta5 spec/unit/cassanity/cql/reconnectable_driver_spec.rb
cassanity-0.6.0.beta4 spec/unit/cassanity/cql/reconnectable_driver_spec.rb