spec/unit/cassanity/client_spec.rb in cassanity-0.4.0 vs spec/unit/cassanity/client_spec.rb in cassanity-0.5.0

- old
+ new

@@ -1,9 +1,16 @@ require 'helper' require 'cassanity/client' describe Cassanity::Client do + let(:driver) { double('Driver') } + + before do + # Ensure that we never hit cassandra for real here. + CassandraCQL::Database.stub(:new => driver) + end + describe "#initialize" do it "passes arguments to cassandra cql database instance" do CassandraCQL::Database.should_receive(:new). with( 'localhost:1234', @@ -70,29 +77,29 @@ instance_of(Hash) ). and_return(driver) Cassanity::Executors::CassandraCql.should_receive(:new). - with(client: driver, instrumenter: instrumenter). + with(hash_including(driver: driver, instrumenter: instrumenter)). and_return(executor) described_class.new('localhost:1234', instrumenter: instrumenter) end it "sets cassandra cql database instance as driver" do client = described_class.new - client.driver.should be_instance_of(CassandraCQL::Database) + client.driver.should be_instance_of(driver.class) end it "builds driver, executor and connection" do driver = double('Driver') executor = double('Executor') connection = double('Connection') CassandraCQL::Database.should_receive(:new).and_return(driver) Cassanity::Executors::CassandraCql.should_receive(:new). - with(hash_including(client: driver)). + with(hash_including(driver: driver)). and_return(executor) Cassanity::Connection.should_receive(:new). with(executor: executor). and_return(connection)