Sha256: f7935d07dee4ccccd13f57dbf353ddcd3efe2f942e8d12e90b72d2db3813ab68

Contents?: true

Size: 1.66 KB

Versions: 5

Compression:

Stored size: 1.66 KB

Contents

require 'helper'
require 'cassanity/argument_generators/keyspace_create'

describe Cassanity::ArgumentGenerators::KeyspaceCreate do
  let(:keyspace_name) { :analytics }

  describe "#call" do
    context "only name" do
      it "returns array of arguments" do
        cql = "CREATE KEYSPACE #{keyspace_name} WITH replication = ?"
        expected = [cql, {class: 'SimpleStrategy', replication_factor: 1}]
        subject.call(keyspace_name: keyspace_name).should eq(expected)
      end
    end

    context "overriding replication class" do
      it "returns array of arguments" do
        cql = "CREATE KEYSPACE #{keyspace_name} WITH replication = ?"
        expected = [cql, {class: 'FooStrategy', replication_factor: 1}]
        subject.call({
          keyspace_name: keyspace_name,
          replication: {class: 'FooStrategy'},
        }).should eq(expected)
      end
    end

    context "overriding a default strategy_option" do
      it "returns array of arguments" do
        cql = "CREATE KEYSPACE #{keyspace_name} WITH replication = ?"
        expected = [cql, {class: 'SimpleStrategy', replication_factor: 3}]
        subject.call({
          keyspace_name: keyspace_name,
          replication: {replication_factor: 3},
        }).should eq(expected)
      end
    end

    context "adding new strategy_option" do
      it "returns array of arguments" do
        cql = "CREATE KEYSPACE #{keyspace_name} WITH replication = ?"
        expected = [cql, {class: 'SimpleStrategy', replication_factor: 1, batman: 'robin'}]
        subject.call({
          keyspace_name: keyspace_name,
          replication: {batman: 'robin'},
        }).should eq(expected)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cassanity-0.6.0.beta5 spec/unit/cassanity/argument_generators/keyspace_create_spec.rb
cassanity-0.6.0.beta4 spec/unit/cassanity/argument_generators/keyspace_create_spec.rb
cassanity-0.6.0.beta3 spec/unit/cassanity/argument_generators/keyspace_create_spec.rb
cassanity-0.6.0.beta2 spec/unit/cassanity/argument_generators/keyspace_create_spec.rb
cassanity-0.6.0.beta1 spec/unit/cassanity/argument_generators/keyspace_create_spec.rb