cassandra_mocks 0.0.8.2 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e116917fa04c58c22eba8ccc9c08e9787a9ba54d
4
- data.tar.gz: a860d89cdece466b8a74af23abb2fd646a6846b5
3
+ metadata.gz: 8e2d95f2fb8187c3115ac8fd3f59323d313ecc68
4
+ data.tar.gz: 1e8626d1efa66a8dca995fbd96baa43bbedbb08a
5
5
  SHA512:
6
- metadata.gz: e98abfe9fe97cb40bcf5f97829d86673902a5e7d0e97257bf84cbbecc5a3f7a67eb20270c6a10ddfc3affb23e88a6ff3f2ab7e0645dd751163c4e6f2f72b7ed1
7
- data.tar.gz: 2898cbb5fd7759b4ddc80d922ee57daf67827887fd7cf24abf1ab638e69bccd28893a79dc88eaecb8dbe55bade37bf8824c2faf3eec4de549e38057fedf41aba
6
+ metadata.gz: aff5b44d199bbb4541ac9bcf415a4161e65be9ac21daeac50967d05c28ca07846de6b73f07ab534ed2dbf17037146f936c53cb90374c30f975676700498ea73a
7
+ data.tar.gz: 4ea6949e26cc0d4ef665288ed2a0bbf0f0ceaa37afdc153aaca55902848738ad925f0301ea1745f751d718d7c21476af87558f8b79c48bc05645fa4a49f8c6e6
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -79,7 +79,7 @@ module Cassandra
79
79
 
80
80
  def select_query(statement)
81
81
  table = cluster.keyspace(keyspace_for_statement(statement)).table(statement.args[:table])
82
- options = statement.args[:filter].merge(limit: statement.args[:limit], order: statement.args[:order])
82
+ options = {restriction: statement.args[:filter], limit: statement.args[:limit], order: statement.args[:order]}
83
83
  table.select(*statement.args[:columns], options)
84
84
  end
85
85
 
@@ -90,7 +90,7 @@ module Cassandra
90
90
 
91
91
  def update_query(statement)
92
92
  table = cluster.keyspace(keyspace_for_statement(statement)).table(statement.args[:table])
93
- rows_to_update = table.select('*', statement.args[:filter])
93
+ rows_to_update = table.select('*', restriction: statement.args[:filter])
94
94
  rows_to_update = [statement.args[:filter].dup] if rows_to_update.empty?
95
95
  rows_to_update.each do |row|
96
96
  updated_row = updated_row(row, statement)
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -88,7 +88,13 @@ module Cassandra
88
88
  Comparitor.new(value.operation, value.column, pending_value(value.value, params))
89
89
  end
90
90
  elsif value.is_a?(Array)
91
- value.map { |value| pending_value(value, params) }
91
+ value.map do |value|
92
+ if value.is_a?(Comparitor)
93
+ Comparitor.new(value.operation, value.column, pending_value(value.value, params))
94
+ else
95
+ pending_value(value, params)
96
+ end
97
+ end
92
98
  else
93
99
  pending_value(value, params)
94
100
  end
@@ -325,7 +331,9 @@ module Cassandra
325
331
 
326
332
  def insert_args(insert_keys, insert_values)
327
333
  insert_keys.count.times.inject({}) do |memo, index|
334
+ key = insert_keys[index]
328
335
  value = mapped_value(insert_values[index])
336
+ value = [memo[key], value] if memo[key]
329
337
  memo.merge!(insert_keys[index] => value)
330
338
  end
331
339
  end
@@ -29,6 +29,7 @@ module Cassandra
29
29
  filter = select_filter(columns)
30
30
  limit = filter.delete(:limit)
31
31
  order = select_order(filter)
32
+ filter = filter.fetch(:restriction) { {} }
32
33
  unless filter.empty?
33
34
  validate_partion_key_filter!(filter)
34
35
  validate_clustering_column_filter!(filter)
@@ -48,7 +49,7 @@ module Cassandra
48
49
  end
49
50
 
50
51
  def delete(filter)
51
- rows_to_remove = select('*', filter)
52
+ rows_to_remove = select('*', restriction: filter)
52
53
  @rows.reject! { |row| rows_to_remove.include?(row) }
53
54
  end
54
55
 
@@ -149,7 +150,11 @@ module Cassandra
149
150
  if value.is_a?(Statement::Comparitor)
150
151
  value.check_against(partial_row)
151
152
  elsif value.is_a?(Array)
152
- value.include?(partial_row[column])
153
+ if value.first.is_a?(Statement::Comparitor)
154
+ value.all? { |value| value.check_against(partial_row) }
155
+ else
156
+ value.include?(partial_row[column])
157
+ end
153
158
  else
154
159
  partial_row[column] == value
155
160
  end
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra_mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.2
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas RM Rogers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cassandra-driver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
41
  description: |-
@@ -73,12 +73,12 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []