whi-cassie 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.txt +4 -0
- data/VERSION +1 -1
- data/lib/cassie.rb +7 -3
- data/spec/cassie_spec.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f85b689086bd176a805cd0fcdd9ba9cab4980d75
|
4
|
+
data.tar.gz: e596bacb6ddd3393c5d1fd93d49da61d1898333b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de080c2f8d0a523d754dbfa0aee4215cc64923e1f122c6ddce85a58c7becb97b02616540cdc880b1dd2c993aed89396f91123393cd374f4b90189da5fc571871
|
7
|
+
data.tar.gz: 2bc5d0e2ea0aa0e8ee43cbe86789b497ad8e421bda9365bcf4d5493e1ddeec647b22383e89ca35c8f254d9e5d5056389cd4fafd346de8ede7a9493792c546fae
|
data/HISTORY.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/lib/cassie.rb
CHANGED
@@ -270,8 +270,12 @@ class Cassie
|
|
270
270
|
start_time = Time.now
|
271
271
|
begin
|
272
272
|
statement = nil
|
273
|
-
if cql.is_a?(String)
|
274
|
-
|
273
|
+
if cql.is_a?(String)
|
274
|
+
if values.present?
|
275
|
+
statement = prepare(cql)
|
276
|
+
else
|
277
|
+
statement = Cassandra::Statements::Simple.new(cql)
|
278
|
+
end
|
275
279
|
else
|
276
280
|
statement = cql
|
277
281
|
end
|
@@ -292,7 +296,7 @@ class Cassie
|
|
292
296
|
disconnect
|
293
297
|
raise e
|
294
298
|
ensure
|
295
|
-
|
299
|
+
if statement.is_a?(Cassandra::Statement) && !subscribers.empty?
|
296
300
|
payload = Message.new(statement, options, Time.now - start_time)
|
297
301
|
subscribers.each{|subscriber| subscriber.call(payload)}
|
298
302
|
end
|
data/spec/cassie_spec.rb
CHANGED
@@ -134,6 +134,13 @@ describe Cassie do
|
|
134
134
|
message.options.should == {:arguments => [1]}
|
135
135
|
message.elapsed_time.should be_a(Float)
|
136
136
|
|
137
|
+
instance.execute("SELECT owner, id, val FROM #{table} WHERE owner = 1")
|
138
|
+
messages.size.should == 1
|
139
|
+
message = messages.shift
|
140
|
+
message.statement.should be_a(Cassandra::Statement)
|
141
|
+
message.options.should == nil
|
142
|
+
message.elapsed_time.should be_a(Float)
|
143
|
+
|
137
144
|
instance.batch do
|
138
145
|
instance.insert(table, :owner => 1, :id => 2, :val => 'foo')
|
139
146
|
instance.delete(table, :owner => 1)
|
@@ -153,19 +160,19 @@ describe Cassie do
|
|
153
160
|
let(:session){ instance.send(:session) }
|
154
161
|
|
155
162
|
it "should not specify query consistency by default" do
|
156
|
-
expect(session).to receive(:execute).with("SELECT * FROM dual", {})
|
163
|
+
expect(session).to receive(:execute).with(Cassandra::Statements::Simple.new("SELECT * FROM dual"), {})
|
157
164
|
instance.execute("SELECT * FROM dual")
|
158
165
|
end
|
159
166
|
|
160
167
|
it "should allow specifying the consistency in a block" do
|
161
|
-
expect(session).to receive(:execute).with("SELECT * FROM dual", {:consistency => :one})
|
168
|
+
expect(session).to receive(:execute).with(Cassandra::Statements::Simple.new("SELECT * FROM dual"), {:consistency => :one})
|
162
169
|
Cassie.consistency(:one) do
|
163
170
|
instance.execute("SELECT * FROM dual")
|
164
171
|
end
|
165
172
|
end
|
166
173
|
|
167
174
|
it "should use the consistency specified to execute if provided" do
|
168
|
-
expect(session).to receive(:execute).with("SELECT * FROM dual", {:consistency => :two})
|
175
|
+
expect(session).to receive(:execute).with(Cassandra::Statements::Simple.new("SELECT * FROM dual"), {:consistency => :two})
|
169
176
|
Cassie.consistency(:one) do
|
170
177
|
instance.execute("SELECT * FROM dual", nil, :consistency => :two)
|
171
178
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whi-cassie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- We Heart It
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cassandra-driver
|