rico 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -61,7 +61,7 @@ end
61
61
 
62
62
  ```ruby
63
63
  a = Rico::Array.new "bucket", "key"
64
- a.add 3, 1, 1, 4, 2
64
+ a.add [3, 1, 1, 4, 2]
65
65
  a.members # => [3, 1, 1, 4, 2]
66
66
  a.length # => 5
67
67
  ```
@@ -70,7 +70,7 @@ a.length # => 5
70
70
 
71
71
  ```ruby
72
72
  l = Rico::List.new "bucket", "key"
73
- l.add 3, 1, 1, 4, 2
73
+ l.add [3, 1, 1, 4, 2]
74
74
  l.members # => [1, 1, 2, 3, 4]
75
75
  l.length # => 5
76
76
  ```
@@ -79,7 +79,7 @@ l.length # => 5
79
79
 
80
80
  ```ruby
81
81
  s = Rico::Set.new "bucket", "key"
82
- s.add 3, 1, 1, 4, 2
82
+ s.add [3, 1, 1, 4, 2]
83
83
  s.members # => [3, 1, 4, 2]
84
84
  s.length # => 4
85
85
  ```
@@ -88,7 +88,7 @@ s.length # => 4
88
88
 
89
89
  ```ruby
90
90
  s = Rico::SortedSet.new "bucket", "key"
91
- s.add 3, 1, 1, 4, 2
91
+ s.add [3, 1, 1, 4, 2]
92
92
  s.members # => [1, 2, 3, 4]
93
93
  s.length # => 4
94
94
  ```
@@ -143,7 +143,7 @@ v.exists? # => true
143
143
  ```ruby
144
144
  s = Rico::Set.new "bucket", "key"
145
145
  s.content_type = "application/x-gzip"
146
- s.add 1, 2, 3
146
+ s.add [1,2,3]
147
147
  s.get # => [1, 2, 3]
148
148
  s.raw_data # => "\u001F\x8B\b\u0000G...."
149
149
  ```
data/lib/rico/array.rb CHANGED
@@ -32,5 +32,23 @@ module Rico
32
32
  obj.data = { "_values" => result, "_deletes" => deletions }
33
33
  obj
34
34
  end
35
+
36
+ protected
37
+
38
+ def build_map_add(items)
39
+ { "_type" => type_key, "_values" => compute_add(items) }
40
+ end
41
+
42
+ def build_map_remove(items)
43
+ { "_type" => type_key, "_values" => compute_remove(items), "_deletes" => items }
44
+ end
45
+
46
+ def compute_add(items)
47
+ members + Array(items)
48
+ end
49
+
50
+ def compute_remove(items)
51
+ members - Array(items)
52
+ end
35
53
  end
36
54
  end
@@ -11,7 +11,7 @@ module Rico
11
11
  # items - items to be added to the array
12
12
  #
13
13
  # Returns the result of the store operation
14
- def add(*items)
14
+ def add(items)
15
15
  mutate build_map_add(items)
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ module Rico
20
20
  # items - items to be removed from the array
21
21
  #
22
22
  # Returns the result of the store operation
23
- def remove(*items)
23
+ def remove(items)
24
24
  mutate build_map_remove(items)
25
25
  end
26
26
 
@@ -32,23 +32,5 @@ module Rico
32
32
  def member?(item)
33
33
  members.include? item
34
34
  end
35
-
36
- protected
37
-
38
- def build_map_add(items)
39
- { "_type" => type_key, "_values" => compute_add(items) }
40
- end
41
-
42
- def build_map_remove(items)
43
- { "_type" => type_key, "_values" => compute_remove(items), "_deletes" => items }
44
- end
45
-
46
- def compute_add(items)
47
- members + items
48
- end
49
-
50
- def compute_remove(items)
51
- members - items
52
- end
53
35
  end
54
36
  end
data/lib/rico/map.rb CHANGED
@@ -29,15 +29,17 @@ module Rico
29
29
 
30
30
  protected
31
31
 
32
+ def build_map_add(items)
33
+ { "_type" => type_key, "_values" => compute_add(items) }
34
+ end
35
+
32
36
  def build_map_remove(items)
33
37
  keys = extract_keys(items)
34
38
  { "_type" => type_key, "_values" => compute_remove(items), "_deletes" => keys }
35
39
  end
36
40
 
37
41
  def compute_add(items)
38
- Array(items).inject(members) do |res, h|
39
- res.merge(h)
40
- end
42
+ members.merge(items)
41
43
  end
42
44
 
43
45
  def compute_remove(items)
data/lib/rico/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rico
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/spec/array_spec.rb CHANGED
@@ -6,91 +6,91 @@ describe Rico::Array do
6
6
  end
7
7
 
8
8
  describe "#add" do
9
- it "writes values to an array" do
10
- a = Rico::Array.new RiakHelpers.bucket, "add_writes_values"
11
- a.add(1, 2, 3)
12
- b = Rico::Array.new RiakHelpers.bucket, "add_writes_values"
13
- b.members.should eql [1, 2, 3]
9
+ it "writes a single value to an array" do
10
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_single_value"
11
+ a.add 5
12
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_single_value"
13
+ b.members.should eql [5]
14
14
  end
15
15
 
16
- it "retains a single value as an array" do
17
- a = Rico::Array.new RiakHelpers.bucket, "add_flattens_values"
18
- a.add([1, 2, 3])
19
- b = Rico::Array.new RiakHelpers.bucket, "add_flattens_values"
20
- b.members.should eql [[1, 2, 3]]
16
+ it "writes values to an array" do
17
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_writes_values"
18
+ a.add [1, 2, 3]
19
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_writes_values"
20
+ b.members.should eql [1, 2, 3]
21
21
  end
22
22
 
23
23
  it "allows duplicate values" do
24
- a = Rico::Array.new RiakHelpers.bucket, "add_allows_duplicates"
25
- a.add(1, 2, 3)
26
- a.add(2, 3, 4)
27
- b = Rico::Array.new RiakHelpers.bucket, "add_allows_duplicates"
24
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_allows_duplicates"
25
+ a.add [1, 2, 3]
26
+ a.add [2, 3, 4]
27
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_allows_duplicates"
28
28
  b.members.should eql [1, 2, 3, 2, 3, 4]
29
29
  end
30
30
 
31
31
  it "retains order of addition" do
32
- a = Rico::Array.new RiakHelpers.bucket, "add_retains_order"
33
- a.add(5, 3, 1, 6, 7)
34
- b = Rico::Array.new RiakHelpers.bucket, "add_retains_order"
32
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_retains_order"
33
+ a.add [5, 3, 1, 6, 7]
34
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_retains_order"
35
35
  b.members.should eql [5, 3, 1, 6, 7]
36
36
  end
37
37
 
38
38
  it "works with strings" do
39
- a = Rico::Array.new RiakHelpers.bucket, "add_works_with_strings"
40
- a.add("john", "joe", "jason")
41
- a.add("brian", "bob")
42
- b = Rico::Array.new RiakHelpers.bucket, "add_works_with_strings"
39
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_strings"
40
+ a.add ["john", "joe", "jason"]
41
+ a.add ["brian", "bob"]
42
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_strings"
43
43
  b.members.should eql ["john", "joe", "jason", "brian", "bob"]
44
44
  end
45
45
 
46
46
  it "works with arrays" do
47
- a = Rico::Array.new RiakHelpers.bucket, "add_works_with_arrays"
48
- a.add([1,2,3], [4,5,6], [7,8,9])
49
- a.add(["a", "b", 37.2])
50
- b = Rico::Array.new RiakHelpers.bucket, "add_works_with_arrays"
47
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_arrays"
48
+ a.add [[1,2,3], [4,5,6], [7,8,9]]
49
+ a.add [["a", "b", 37.2]]
50
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_arrays"
51
51
  b.members.should eql [[1,2,3], [4,5,6], [7,8,9], ["a", "b", 37.2]]
52
52
  end
53
53
 
54
54
  it "works with hashmaps" do
55
- a = Rico::Array.new RiakHelpers.bucket, "add_works_with_hashmaps"
56
- a.add({a: 1, b: 2}, {charlie: 6})
57
- a.add({"usd" => 37.2, "eur" => 31.6})
58
- b = Rico::Array.new RiakHelpers.bucket, "add_works_with_hashmaps"
55
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_hashmaps"
56
+ a.add [{a: 1, b: 2}, {charlie: 6}]
57
+ a.add [{"usd" => 37.2, "eur" => 31.6}]
58
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_hashmaps"
59
59
  b.members.should eql [{"a" => 1, "b" => 2}, {"charlie" => 6}, {"usd" => 37.2, "eur" => 31.6}]
60
60
  end
61
61
 
62
62
  it "works with mixed types" do
63
- a = Rico::Array.new RiakHelpers.bucket, "add_works_with_mixed_types"
64
- a.add({"usd" => 123.41, "cad" => 61.89})
65
- a.add("Bears", "Beets", "Battlestar Galactica")
66
- a.add(3.14159)
67
- a.add(71)
68
- b = Rico::Array.new RiakHelpers.bucket, "add_works_with_mixed_types"
63
+ a = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_mixed_types"
64
+ a.add [{"usd" => 123.41, "cad" => 61.89}]
65
+ a.add ["Bears", "Beets", "Battlestar Galactica"]
66
+ a.add 3.14159
67
+ a.add 71
68
+ b = Rico::Array.new RiakHelpers.bucket, "array_add_works_with_mixed_types"
69
69
  b.members.should eql [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71]
70
70
  end
71
71
  end
72
72
 
73
73
  describe "#remove" do
74
74
  it "removes existing values" do
75
- a = Rico::Array.new RiakHelpers.bucket, "remove_removes"
76
- a.add({"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", :slumdog, "Battlestar Galactica", 3.14159, 71)
77
- b = Rico::Array.new RiakHelpers.bucket, "remove_removes"
78
- b.remove(3.14159, "Beets")
79
- b.remove("slumdog")
80
- c = Rico::Array.new RiakHelpers.bucket, "remove_removes"
75
+ a = Rico::Array.new RiakHelpers.bucket, "array_remove_removes"
76
+ a.add [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", :slumdog, "Battlestar Galactica", 3.14159, 71]
77
+ b = Rico::Array.new RiakHelpers.bucket, "array_remove_removes"
78
+ b.remove [3.14159, "Beets"]
79
+ b.remove ["slumdog"]
80
+ c = Rico::Array.new RiakHelpers.bucket, "array_remove_removes"
81
81
  c.members.should eql [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Battlestar Galactica", 71]
82
82
  end
83
83
 
84
84
  it "does not throw on removal on non-key" do
85
85
  lambda do
86
- Rico::Array.new(RiakHelpers.bucket, "remove_nonkey").remove("bill")
86
+ Rico::Array.new(RiakHelpers.bucket, "array_remove_nonkey").remove("bill")
87
87
  end.should_not raise_error
88
88
  end
89
89
 
90
90
  it "does not throw on removal on non-value" do
91
91
  lambda do
92
- a = Rico::Array.new RiakHelpers.bucket, "remove_nonvalue"
93
- a.add 37, 68, 54
92
+ a = Rico::Array.new RiakHelpers.bucket, "array_remove_nonvalue"
93
+ a.add [37, 68, 54]
94
94
  a.remove "josh"
95
95
  end.should_not raise_error
96
96
  end
@@ -98,44 +98,44 @@ describe Rico::Array do
98
98
 
99
99
  describe "#members" do
100
100
  it "returns a list of members" do
101
- a = Rico::Array.new RiakHelpers.bucket, "members_lists"
102
- a.add({"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71)
103
- b = Rico::Array.new RiakHelpers.bucket, "members_lists"
101
+ a = Rico::Array.new RiakHelpers.bucket, "array_members_lists"
102
+ a.add [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71]
103
+ b = Rico::Array.new RiakHelpers.bucket, "array_members_lists"
104
104
  b.members.should eql [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71]
105
105
  end
106
106
  end
107
107
 
108
108
  describe "#member?" do
109
109
  it "returns a true if a member" do
110
- a = Rico::Array.new RiakHelpers.bucket, "members_lists"
111
- a.add({"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71)
112
- b = Rico::Array.new RiakHelpers.bucket, "members_lists"
110
+ a = Rico::Array.new RiakHelpers.bucket, "array_members_lists"
111
+ a.add [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71]
112
+ b = Rico::Array.new RiakHelpers.bucket, "array_members_lists"
113
113
  b.member?({"usd" => 123.41, "cad" => 61.89}).should eql true
114
114
  end
115
115
 
116
116
  it "returns a true if not a member" do
117
- a = Rico::Array.new RiakHelpers.bucket, "members_lists"
118
- a.add({"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71)
119
- b = Rico::Array.new RiakHelpers.bucket, "members_lists"
117
+ a = Rico::Array.new RiakHelpers.bucket, "array_members_lists"
118
+ a.add [{"usd" => 123.41, "cad" => 61.89}, "Bears", "Beets", "Battlestar Galactica", 3.14159, 71]
119
+ b = Rico::Array.new RiakHelpers.bucket, "array_members_lists"
120
120
  b.member?({"usd" => 123.42, "cad" => 61.89}).should eql false
121
121
  end
122
122
  end
123
123
 
124
124
  describe "#length" do
125
125
  it "returns zero for an empty list" do
126
- a = Rico::Array.new RiakHelpers.bucket, "length_empty"
126
+ a = Rico::Array.new RiakHelpers.bucket, "array_length_empty"
127
127
  a.length.should eql 0
128
128
  end
129
129
 
130
130
  it "returns the number of entries" do
131
- a = Rico::Array.new RiakHelpers.bucket, "length_6"
132
- a.add(1, 2, 3, 4, 5, 6)
131
+ a = Rico::Array.new RiakHelpers.bucket, "array_length_6"
132
+ a.add [1, 2, 3, 4, 5, 6]
133
133
  a.length.should eql 6
134
134
  end
135
135
 
136
136
  it "is aliased to #count" do
137
- a = Rico::Array.new RiakHelpers.bucket, "length_alias"
138
- a.add(1, 2, 3, 4, 5, 6)
137
+ a = Rico::Array.new RiakHelpers.bucket, "array_length_alias"
138
+ a.add [1, 2, 3, 4, 5, 6]
139
139
  a.count.should eql 6
140
140
  end
141
141
  end
@@ -164,8 +164,8 @@ describe Rico::Array do
164
164
  end
165
165
 
166
166
  it "is enumerable" do
167
- a = Rico::Array.new RiakHelpers.bucket, "enumerable"
168
- a.add(3, 1, 4, 1, 5, 9)
167
+ a = Rico::Array.new RiakHelpers.bucket, "array_enumerable"
168
+ a.add [3, 1, 4, 1, 5, 9]
169
169
  a.to_a.should eql [3, 1, 4, 1, 5, 9]
170
170
  a.each { }.length.should eql 6
171
171
  a.map {|x| x + 1 }.should eql [4, 2, 5, 2, 6, 10]
data/spec/list_spec.rb CHANGED
@@ -8,20 +8,20 @@ describe Rico::List do
8
8
  describe "#add" do
9
9
  it "adds values and sorts them in instance" do
10
10
  a = Rico::List.new RiakHelpers.bucket, "list_add_1"
11
- a.add(3, 2, 1)
11
+ a.add [3, 2, 1]
12
12
  a.members.should eql [1, 2, 3]
13
13
  end
14
14
 
15
15
  it "adds values and sorts them on read" do
16
16
  a = Rico::List.new RiakHelpers.bucket, "list_add_2"
17
- a.add(3, 2, 1)
17
+ a.add [3, 2, 1]
18
18
  b = Rico::List.new RiakHelpers.bucket, "list_add_2"
19
19
  b.members.should eql [1, 2, 3]
20
20
  end
21
21
 
22
22
  it "allows duplicates of the same value" do
23
23
  a = Rico::List.new RiakHelpers.bucket, "list_add_duplicate"
24
- a.add(3, 6, 4, 1, 7, 9, 1, 1, 3, 3)
24
+ a.add [3, 6, 4, 1, 7, 9, 1, 1, 3, 3]
25
25
  b = Rico::List.new RiakHelpers.bucket, "list_add_duplicate"
26
26
  b.members.should eql [1, 1, 1, 3, 3, 3, 4, 6, 7, 9]
27
27
  end
@@ -30,9 +30,9 @@ describe Rico::List do
30
30
  describe "#remove" do
31
31
  it "removes all occurence of the item" do
32
32
  a = Rico::List.new RiakHelpers.bucket, "list_remove_all_duplicates"
33
- a.add(1, 1, 1, 2, 2, 2)
33
+ a.add [1, 1, 1, 2, 2, 2]
34
34
  b = Rico::List.new RiakHelpers.bucket, "list_remove_all_duplicates"
35
- b.remove(1, 2)
35
+ b.remove [1, 2]
36
36
  c = Rico::List.new RiakHelpers.bucket, "list_remove_all_duplicates"
37
37
  c.members.should eql []
38
38
  end
data/spec/map_spec.rb CHANGED
@@ -13,13 +13,6 @@ describe Rico::Map do
13
13
  b.members.should eql({"a" => 1, "b" => 2, "c" => 3, "d" => 4, "e" => 5})
14
14
  end
15
15
 
16
- it "writes multiple hashes to the map" do
17
- a = Rico::Map.new RiakHelpers.bucket, "map_add_multiple_hashes"
18
- a.add({"a" => 1, "b" => 2, "c" => 3}, {"d" => 4, "e" => 5})
19
- b = Rico::Map.new RiakHelpers.bucket, "map_add_multiple_hashes"
20
- b.members.should eql({"a" => 1, "b" => 2, "c" => 3, "d" => 4, "e" => 5})
21
- end
22
-
23
16
  it "supports multiple multiple writes to the map" do
24
17
  a = Rico::Map.new RiakHelpers.bucket, "map_add_multiple_writes"
25
18
  a.add({"a" => 1, "b" => 2, "c" => 3})
@@ -27,6 +20,14 @@ describe Rico::Map do
27
20
  b = Rico::Map.new RiakHelpers.bucket, "map_add_multiple_writes"
28
21
  b.members.should eql({"a" => 1, "b" => 2, "c" => 3, "d" => 4, "e" => 5})
29
22
  end
23
+
24
+ it "merges in the right order with implicit deduping" do
25
+ a = Rico::Map.new RiakHelpers.bucket, "map_add_order_dedupe"
26
+ a.add({"a" => 1, "b" => 2, "c" => 3})
27
+ a.add({"b" => "B", "c" => "C"})
28
+ b = Rico::Map.new RiakHelpers.bucket, "map_add_order_dedupe"
29
+ b.members.should eql({"a" => 1, "b" => "B", "c" => "C"})
30
+ end
30
31
  end
31
32
 
32
33
  describe "#remove" do
@@ -43,7 +44,7 @@ describe Rico::Map do
43
44
  a = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_string"
44
45
  a.add({"a" => 1, "b" => 2, "c" => 3})
45
46
  b = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_string"
46
- b.remove("a", "c")
47
+ b.remove(["a", "c"])
47
48
  c = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_string"
48
49
  c.members.should eql({"b" => 2})
49
50
  end
@@ -52,7 +53,7 @@ describe Rico::Map do
52
53
  a = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_symbol"
53
54
  a.add({"a" => 1, "b" => 2, "c" => 3})
54
55
  b = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_symbol"
55
- b.remove(:a, :c)
56
+ b.remove([:a, :c])
56
57
  c = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_symbol"
57
58
  c.members.should eql({"b" => 2})
58
59
  end
@@ -61,7 +62,7 @@ describe Rico::Map do
61
62
  a = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_integer"
62
63
  a.add({1 => 1, 2 => 2, 3 => 3})
63
64
  b = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_integer"
64
- b.remove(1, 3)
65
+ b.remove([1, 3])
65
66
  c = Rico::Map.new RiakHelpers.bucket, "map_remove_multiple_keys_integer"
66
67
  c.members.should eql({"2" => 2})
67
68
  end
@@ -70,9 +71,17 @@ describe Rico::Map do
70
71
  a = Rico::Map.new RiakHelpers.bucket, "map_remove_single_key_tuple"
71
72
  a.add({"a" => 1, "b" => 2, "c" => 3})
72
73
  b = Rico::Map.new RiakHelpers.bucket, "map_remove_single_key_tuple"
73
- b.remove({"a" => 1})
74
+ b.remove({"a" => 1, "b" => 2})
74
75
  c = Rico::Map.new RiakHelpers.bucket, "map_remove_single_key_tuple"
75
- c.members.should eql({"b" => 2, "c" => 3})
76
+ c.members.should eql({"c" => 3})
77
+ end
78
+
79
+ it "merges in the right order with implicit deduping" do
80
+ a = Rico::Map.new RiakHelpers.bucket, "map_remove_order_dedupe"
81
+ a.add({"a" => 1, "b" => 2, "c" => 3, "d" => 4})
82
+ a.remove({"b" => 2, "c" => 3, "c" => 3, "c" => 3})
83
+ b = Rico::Map.new RiakHelpers.bucket, "map_remove_order_dedupe"
84
+ b.members.should eql({"a" => 1, "d" => 4})
76
85
  end
77
86
  end
78
87
 
data/spec/set_spec.rb CHANGED
@@ -8,13 +8,13 @@ describe Rico::Set do
8
8
  describe "#add" do
9
9
  it "dedupes and retains order in instance" do
10
10
  a = Rico::Set.new RiakHelpers.bucket, "set_add_1"
11
- a.add(3, 4, 6, 8, 1, 2, 3, 4, 7)
11
+ a.add [3, 4, 6, 8, 1, 2, 3, 4, 7]
12
12
  a.members.should eql [3, 4, 6, 8, 1, 2, 7]
13
13
  end
14
14
 
15
15
  it "dedupes and sort is retained on read" do
16
16
  a = Rico::Set.new RiakHelpers.bucket, "set_add_2"
17
- a.add(3, 4, 6, 8, 1, 2, 3, 4, 7)
17
+ a.add [3, 4, 6, 8, 1, 2, 3, 4, 7]
18
18
  b = Rico::Set.new RiakHelpers.bucket, "set_add_2"
19
19
  b.members.should eql [3, 4, 6, 8, 1, 2, 7]
20
20
  end
@@ -8,13 +8,13 @@ describe Rico::SortedSet do
8
8
  describe "#add" do
9
9
  it "dedupes and sorts in instance" do
10
10
  a = Rico::SortedSet.new RiakHelpers.bucket, "sorted_set_add_1"
11
- a.add(3, 2, 2, 1, 1)
11
+ a.add [3, 2, 2, 1, 1]
12
12
  a.members.should eql [1, 2, 3]
13
13
  end
14
14
 
15
15
  it "dedupes and sort is retained on read" do
16
16
  a = Rico::SortedSet.new RiakHelpers.bucket, "sorted_set_add_2"
17
- a.add(3, 3, 2, 2, 1)
17
+ a.add [3, 3, 2, 2, 1]
18
18
  b = Rico::SortedSet.new RiakHelpers.bucket, "sorted_set_add_2"
19
19
  b.members.should eql [1, 2, 3]
20
20
  end
data/spec/spec_helper.rb CHANGED
@@ -16,10 +16,6 @@ module RiakHelpers
16
16
  b.keys.each do |k|
17
17
  b.delete k
18
18
  end
19
-
20
- a = Rico::Array.new bucket, "visual_array"
21
- a.add 1,2,3,4,5,6
22
- a.remove 6
23
19
  end
24
20
 
25
21
  def self.build_conflicted_robject(key, values)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: