Sha256: e4ffead37f631e914c16ab2e8fdcd64df9eff918c8ed1abbd41214dd33f63e13

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

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