cassanity 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/Changelog.md +5 -0
  2. data/Guardfile +8 -1
  3. data/README.md +8 -0
  4. data/examples/_shared.rb +1 -0
  5. data/examples/batch.rb +4 -1
  6. data/examples/column_families.rb +3 -1
  7. data/examples/counters.rb +90 -0
  8. data/examples/keyspaces.rb +3 -1
  9. data/examples/select_range.rb +118 -0
  10. data/lib/cassanity/argument_generators/set_clause.rb +7 -8
  11. data/lib/cassanity/argument_generators/where_clause.rb +19 -1
  12. data/lib/cassanity/decrement.rb +27 -0
  13. data/lib/cassanity/executors/cassandra_cql.rb +1 -1
  14. data/lib/cassanity/increment.rb +27 -0
  15. data/lib/cassanity/operator.rb +27 -0
  16. data/lib/cassanity/operators/eq.rb +15 -0
  17. data/lib/cassanity/operators/gt.rb +15 -0
  18. data/lib/cassanity/operators/gte.rb +15 -0
  19. data/lib/cassanity/operators/lt.rb +15 -0
  20. data/lib/cassanity/operators/lte.rb +15 -0
  21. data/lib/cassanity/version.rb +1 -1
  22. data/lib/cassanity.rb +84 -0
  23. data/spec/integration/cassanity/column_family_spec.rb +69 -2
  24. data/spec/unit/cassanity/argument_generators/set_clause_spec.rb +9 -46
  25. data/spec/unit/cassanity/argument_generators/where_clause_spec.rb +87 -8
  26. data/spec/unit/cassanity/decrement_spec.rb +68 -0
  27. data/spec/unit/cassanity/increment_spec.rb +68 -0
  28. data/spec/unit/cassanity/operator_spec.rb +58 -0
  29. data/spec/unit/cassanity/operators/eq_spec.rb +24 -0
  30. data/spec/unit/cassanity/operators/gt_spec.rb +24 -0
  31. data/spec/unit/cassanity/operators/gte_spec.rb +24 -0
  32. data/spec/unit/cassanity/operators/lt_spec.rb +24 -0
  33. data/spec/unit/cassanity/operators/lte_spec.rb +24 -0
  34. data/spec/unit/cassanity_spec.rb +118 -0
  35. metadata +30 -4
@@ -1,5 +1,123 @@
1
1
  require 'helper'
2
2
 
3
3
  describe Cassanity do
4
+ describe ".eq" do
5
+ it "returns equality operator" do
6
+ Cassanity.eq(5).should eq(Cassanity::Operators::Eq.new(5))
7
+ end
8
+ end
4
9
 
10
+ describe ".equal" do
11
+ it "returns equality operator" do
12
+ Cassanity.equal(5).should eq(Cassanity::Operators::Eq.new(5))
13
+ end
14
+ end
15
+
16
+ describe ".gt" do
17
+ it "returns greater than operator" do
18
+ Cassanity.gt(5).should eq(Cassanity::Operators::Gt.new(5))
19
+ end
20
+ end
21
+
22
+ describe ".greater_than" do
23
+ it "returns greater than operator" do
24
+ Cassanity.greater_than(5).should eq(Cassanity::Operators::Gt.new(5))
25
+ end
26
+ end
27
+
28
+ describe ".gte" do
29
+ it "returns greater than or equal to operator" do
30
+ Cassanity.gte(5).should eq(Cassanity::Operators::Gte.new(5))
31
+ end
32
+ end
33
+
34
+ describe ".greater_than_or_equal_to" do
35
+ it "returns greater than operator" do
36
+ Cassanity.greater_than_or_equal_to(5).should eq(Cassanity::Operators::Gte.new(5))
37
+ end
38
+ end
39
+
40
+ describe ".lt" do
41
+ it "returns less than operator" do
42
+ Cassanity.lt(5).should eq(Cassanity::Operators::Lt.new(5))
43
+ end
44
+ end
45
+
46
+ describe ".less_than" do
47
+ it "returns less than operator" do
48
+ Cassanity.less_than(5).should eq(Cassanity::Operators::Lt.new(5))
49
+ end
50
+ end
51
+
52
+ describe ".lte" do
53
+ it "returns less than or equal to operator" do
54
+ Cassanity.lte(5).should eq(Cassanity::Operators::Lte.new(5))
55
+ end
56
+ end
57
+
58
+ describe ".less_than_or_equal_to" do
59
+ it "returns less than or equal to operator" do
60
+ Cassanity.less_than_or_equal_to(5).should eq(Cassanity::Operators::Lte.new(5))
61
+ end
62
+ end
63
+
64
+ describe ".inc" do
65
+ it "returns increment instance" do
66
+ Cassanity.inc(5).should eq(Cassanity::Increment.new(5))
67
+ end
68
+
69
+ it "returns increment instance with value of 1" do
70
+ Cassanity.inc.should eq(Cassanity::Increment.new(1))
71
+ end
72
+ end
73
+
74
+ describe ".incr" do
75
+ it "returns increment instance" do
76
+ Cassanity.incr(5).should eq(Cassanity::Increment.new(5))
77
+ end
78
+
79
+ it "returns increment instance with value of 1" do
80
+ Cassanity.incr.should eq(Cassanity::Increment.new(1))
81
+ end
82
+ end
83
+
84
+ describe ".increment" do
85
+ it "returns increment instance" do
86
+ Cassanity.increment(5).should eq(Cassanity::Increment.new(5))
87
+ end
88
+
89
+ it "returns increment instance with value of 1" do
90
+ Cassanity.increment.should eq(Cassanity::Increment.new(1))
91
+ end
92
+ end
93
+
94
+ describe ".dec" do
95
+ it "returns decrement instance" do
96
+ Cassanity.dec(5).should eq(Cassanity::Decrement.new(5))
97
+ end
98
+
99
+ it "returns decrement instance with value of 1" do
100
+ Cassanity.dec.should eq(Cassanity::Decrement.new(1))
101
+ end
102
+ end
103
+
104
+ describe ".decr" do
105
+ it "returns decrement instance" do
106
+ Cassanity.decr(5).should eq(Cassanity::Decrement.new(5))
107
+ end
108
+
109
+ it "returns decrement instance with value of 1" do
110
+ Cassanity.decr.should eq(Cassanity::Decrement.new(1))
111
+ end
112
+ end
113
+
114
+ describe ".decrement" do
115
+ it "returns decrement instance" do
116
+ Cassanity.decrement(5).should eq(Cassanity::Decrement.new(5))
117
+ end
118
+
119
+ it "returns decrement instance with value of 1" do
120
+ Cassanity.decrement.should eq(Cassanity::Decrement.new(1))
121
+ end
122
+ end
5
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassanity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cassandra-cql
@@ -48,7 +48,9 @@ files:
48
48
  - examples/_shared.rb
49
49
  - examples/batch.rb
50
50
  - examples/column_families.rb
51
+ - examples/counters.rb
51
52
  - examples/keyspaces.rb
53
+ - examples/select_range.rb
52
54
  - lib/cassanity.rb
53
55
  - lib/cassanity/argument_generators/batch.rb
54
56
  - lib/cassanity/argument_generators/column_families.rb
@@ -74,9 +76,17 @@ files:
74
76
  - lib/cassanity/argument_generators/with_clause.rb
75
77
  - lib/cassanity/column_family.rb
76
78
  - lib/cassanity/connection.rb
79
+ - lib/cassanity/decrement.rb
77
80
  - lib/cassanity/error.rb
78
81
  - lib/cassanity/executors/cassandra_cql.rb
82
+ - lib/cassanity/increment.rb
79
83
  - lib/cassanity/keyspace.rb
84
+ - lib/cassanity/operator.rb
85
+ - lib/cassanity/operators/eq.rb
86
+ - lib/cassanity/operators/gt.rb
87
+ - lib/cassanity/operators/gte.rb
88
+ - lib/cassanity/operators/lt.rb
89
+ - lib/cassanity/operators/lte.rb
80
90
  - lib/cassanity/result_transformers/mirror.rb
81
91
  - lib/cassanity/result_transformers/result_to_array.rb
82
92
  - lib/cassanity/schema.rb
@@ -110,9 +120,17 @@ files:
110
120
  - spec/unit/cassanity/argument_generators/with_clause_spec.rb
111
121
  - spec/unit/cassanity/column_family_spec.rb
112
122
  - spec/unit/cassanity/connection_spec.rb
123
+ - spec/unit/cassanity/decrement_spec.rb
113
124
  - spec/unit/cassanity/error_spec.rb
114
125
  - spec/unit/cassanity/executors/cassandra_cql_spec.rb
126
+ - spec/unit/cassanity/increment_spec.rb
115
127
  - spec/unit/cassanity/keyspace_spec.rb
128
+ - spec/unit/cassanity/operator_spec.rb
129
+ - spec/unit/cassanity/operators/eq_spec.rb
130
+ - spec/unit/cassanity/operators/gt_spec.rb
131
+ - spec/unit/cassanity/operators/gte_spec.rb
132
+ - spec/unit/cassanity/operators/lt_spec.rb
133
+ - spec/unit/cassanity/operators/lte_spec.rb
116
134
  - spec/unit/cassanity/result_transformers/mirror_spec.rb
117
135
  - spec/unit/cassanity/result_transformers/result_to_array_spec.rb
118
136
  - spec/unit/cassanity/schema_spec.rb
@@ -131,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
149
  version: '0'
132
150
  segments:
133
151
  - 0
134
- hash: 878477492175471212
152
+ hash: 3997428165624829659
135
153
  required_rubygems_version: !ruby/object:Gem::Requirement
136
154
  none: false
137
155
  requirements:
@@ -140,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
158
  version: '0'
141
159
  segments:
142
160
  - 0
143
- hash: 878477492175471212
161
+ hash: 3997428165624829659
144
162
  requirements: []
145
163
  rubyforge_project:
146
164
  rubygems_version: 1.8.23
@@ -178,9 +196,17 @@ test_files:
178
196
  - spec/unit/cassanity/argument_generators/with_clause_spec.rb
179
197
  - spec/unit/cassanity/column_family_spec.rb
180
198
  - spec/unit/cassanity/connection_spec.rb
199
+ - spec/unit/cassanity/decrement_spec.rb
181
200
  - spec/unit/cassanity/error_spec.rb
182
201
  - spec/unit/cassanity/executors/cassandra_cql_spec.rb
202
+ - spec/unit/cassanity/increment_spec.rb
183
203
  - spec/unit/cassanity/keyspace_spec.rb
204
+ - spec/unit/cassanity/operator_spec.rb
205
+ - spec/unit/cassanity/operators/eq_spec.rb
206
+ - spec/unit/cassanity/operators/gt_spec.rb
207
+ - spec/unit/cassanity/operators/gte_spec.rb
208
+ - spec/unit/cassanity/operators/lt_spec.rb
209
+ - spec/unit/cassanity/operators/lte_spec.rb
184
210
  - spec/unit/cassanity/result_transformers/mirror_spec.rb
185
211
  - spec/unit/cassanity/result_transformers/result_to_array_spec.rb
186
212
  - spec/unit/cassanity/schema_spec.rb