Permalink
Browse files

Shorten adapter options.

  • Loading branch information...
1 parent c681ab1 commit d4596d35b17e8f98ab6d74f3ed64201552ac2e12 @jnunemaker committed Nov 16, 2012
Showing with 12 additions and 12 deletions.
  1. +3 −3 lib/adapter/cassanity.rb
  2. +9 −9 spec/cassanity_spec.rb
View
@@ -11,7 +11,7 @@ module Cassanity
# Public
def read(key, args = nil)
operation_options = {where: where(key)}
- adapter_options = options[:read_options]
+ adapter_options = options[:read]
arguments = update_arguments(operation_options, adapter_options, args)
rows = client.select(arguments)
@@ -21,7 +21,7 @@ def read(key, args = nil)
# Public
def write(key, attributes, args = nil)
operation_options = {set: encode(attributes), where: where(key)}
- adapter_options = options[:write_options]
+ adapter_options = options[:write]
arguments = update_arguments(operation_options, adapter_options, args)
client.update(arguments)
@@ -30,7 +30,7 @@ def write(key, attributes, args = nil)
# Public
def delete(key, args = nil)
operation_options = {where: where(key)}
- adapter_options = options[:delete_options]
+ adapter_options = options[:delete]
arguments = update_arguments(operation_options, adapter_options, args)
client.delete(arguments)
View
@@ -19,7 +19,7 @@
context "with adapter read options" do
it "uses read options for read method" do
client = COLUMN_FAMILIES[:single]
- options = {read_options: {
+ options = {read: {
using: {consistency: :quorum},
}}
adapter = Adapter[adapter_name].new(client, options)
@@ -34,7 +34,7 @@
it "does not override where" do
client = COLUMN_FAMILIES[:single]
- options = {read_options: {
+ options = {read: {
where: {:some_key => 'bar'},
using: {consistency: :quorum},
}}
@@ -50,7 +50,7 @@
it "can be overriden by read method options" do
client = COLUMN_FAMILIES[:single]
- options = {read_options: {
+ options = {read: {
using: {consistency: :quorum},
}}
adapter = Adapter[adapter_name].new(client, options)
@@ -67,7 +67,7 @@
context "with adapter write options" do
it "uses write options for write method" do
client = COLUMN_FAMILIES[:single]
- options = {write_options: {
+ options = {write: {
using: {consistency: :quorum},
}}
adapter = Adapter[adapter_name].new(client, options)
@@ -83,7 +83,7 @@
it "does not override where or set" do
client = COLUMN_FAMILIES[:single]
- options = {write_options: {
+ options = {write: {
where: {:some_key => 'should not use this'},
set: {'name' => 'should not use this'},
using: {consistency: :quorum,
@@ -101,7 +101,7 @@
it "can be overriden by write method options" do
client = COLUMN_FAMILIES[:single]
- options = {write_options: {
+ options = {write: {
using: {consistency: :quorum},
}}
adapter = Adapter[adapter_name].new(client, options)
@@ -119,7 +119,7 @@
context "with adapter delete options" do
it "uses delete options for delete method" do
client = COLUMN_FAMILIES[:single]
- options = {delete_options: {
+ options = {delete: {
using: {consistency: :quorum},
}}
adapter = Adapter[adapter_name].new(client, options)
@@ -134,7 +134,7 @@
it "does not override where" do
client = COLUMN_FAMILIES[:single]
- options = {delete_options: {
+ options = {delete: {
where: {:some_key => 'bar'},
using: {consistency: :quorum},
}}
@@ -150,7 +150,7 @@
it "can be overriden by delete method options" do
client = COLUMN_FAMILIES[:single]
- options = {delete_options: {
+ options = {delete: {
using: {consistency: :quorum},
}}
adapter = Adapter[adapter_name].new(client, options)

0 comments on commit d4596d3

Please sign in to comment.