cequel 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cequel.rb +1 -0
- data/lib/cequel/errors.rb +1 -0
- data/lib/cequel/metal.rb +1 -0
- data/lib/cequel/metal/batch.rb +1 -0
- data/lib/cequel/metal/batch_manager.rb +1 -0
- data/lib/cequel/metal/cql_row_specification.rb +1 -0
- data/lib/cequel/metal/data_set.rb +1 -0
- data/lib/cequel/metal/deleter.rb +1 -0
- data/lib/cequel/metal/incrementer.rb +1 -0
- data/lib/cequel/metal/inserter.rb +1 -0
- data/lib/cequel/metal/keyspace.rb +1 -0
- data/lib/cequel/metal/logger.rb +1 -0
- data/lib/cequel/metal/logging.rb +1 -0
- data/lib/cequel/metal/new_relic_instrumentation.rb +1 -0
- data/lib/cequel/metal/row.rb +1 -0
- data/lib/cequel/metal/row_specification.rb +1 -0
- data/lib/cequel/metal/statement.rb +1 -0
- data/lib/cequel/metal/updater.rb +1 -0
- data/lib/cequel/metal/writer.rb +1 -0
- data/lib/cequel/record.rb +1 -0
- data/lib/cequel/record/association_collection.rb +1 -0
- data/lib/cequel/record/associations.rb +1 -0
- data/lib/cequel/record/belongs_to_association.rb +1 -0
- data/lib/cequel/record/bound.rb +1 -0
- data/lib/cequel/record/bulk_writes.rb +1 -0
- data/lib/cequel/record/callbacks.rb +1 -0
- data/lib/cequel/record/collection.rb +1 -0
- data/lib/cequel/record/configuration_generator.rb +1 -0
- data/lib/cequel/record/conversion.rb +1 -0
- data/lib/cequel/record/data_set_builder.rb +1 -0
- data/lib/cequel/record/dirty.rb +1 -0
- data/lib/cequel/record/errors.rb +1 -0
- data/lib/cequel/record/has_many_association.rb +1 -0
- data/lib/cequel/record/lazy_record_collection.rb +1 -0
- data/lib/cequel/record/mass_assignment.rb +1 -0
- data/lib/cequel/record/persistence.rb +1 -0
- data/lib/cequel/record/properties.rb +1 -0
- data/lib/cequel/record/railtie.rb +1 -0
- data/lib/cequel/record/record_generator.rb +1 -0
- data/lib/cequel/record/record_set.rb +1 -0
- data/lib/cequel/record/schema.rb +1 -0
- data/lib/cequel/record/scoped.rb +1 -0
- data/lib/cequel/record/secondary_indexes.rb +1 -0
- data/lib/cequel/record/tasks.rb +1 -0
- data/lib/cequel/record/validations.rb +1 -0
- data/lib/cequel/schema.rb +1 -0
- data/lib/cequel/schema/column.rb +1 -0
- data/lib/cequel/schema/create_table_dsl.rb +1 -0
- data/lib/cequel/schema/keyspace.rb +1 -0
- data/lib/cequel/schema/migration_validator.rb +1 -0
- data/lib/cequel/schema/table.rb +1 -0
- data/lib/cequel/schema/table_property.rb +1 -0
- data/lib/cequel/schema/table_reader.rb +1 -0
- data/lib/cequel/schema/table_synchronizer.rb +1 -0
- data/lib/cequel/schema/table_updater.rb +1 -0
- data/lib/cequel/schema/table_writer.rb +1 -0
- data/lib/cequel/schema/update_table_dsl.rb +1 -0
- data/lib/cequel/type.rb +3 -2
- data/lib/cequel/util.rb +1 -0
- data/lib/cequel/version.rb +2 -1
- data/spec/environment.rb +3 -2
- data/spec/examples/metal/data_set_spec.rb +1 -0
- data/spec/examples/record/associations_spec.rb +1 -0
- data/spec/examples/record/callbacks_spec.rb +1 -0
- data/spec/examples/record/dirty_spec.rb +1 -0
- data/spec/examples/record/list_spec.rb +28 -27
- data/spec/examples/record/map_spec.rb +29 -28
- data/spec/examples/record/mass_assignment_spec.rb +1 -0
- data/spec/examples/record/naming_spec.rb +1 -0
- data/spec/examples/record/persistence_spec.rb +1 -0
- data/spec/examples/record/properties_spec.rb +24 -23
- data/spec/examples/record/record_set_spec.rb +1 -0
- data/spec/examples/record/schema_spec.rb +1 -0
- data/spec/examples/record/scoped_spec.rb +1 -0
- data/spec/examples/record/secondary_index_spec.rb +1 -0
- data/spec/examples/record/serialization_spec.rb +1 -0
- data/spec/examples/record/set_spec.rb +12 -11
- data/spec/examples/record/spec_helper.rb +1 -0
- data/spec/examples/record/validations_spec.rb +1 -0
- data/spec/examples/schema/table_reader_spec.rb +1 -0
- data/spec/examples/schema/table_synchronizer_spec.rb +1 -0
- data/spec/examples/schema/table_updater_spec.rb +1 -0
- data/spec/examples/schema/table_writer_spec.rb +1 -0
- data/spec/examples/spec_helper.rb +1 -0
- data/spec/examples/type_spec.rb +1 -0
- data/spec/shared/readable_dictionary.rb +1 -0
- data/spec/support/helpers.rb +1 -0
- data/spec/support/result_stub.rb +1 -0
- data/templates/record.rb +1 -0
- metadata +42 -28
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
1
2
|
require File.expand_path('../spec_helper', __FILE__)
|
|
2
3
|
|
|
3
4
|
describe Cequel::Record::Map do
|
|
@@ -50,17 +51,17 @@ describe Cequel::Record::Map do
|
|
|
50
51
|
post.save
|
|
51
52
|
subject[:likes].should ==
|
|
52
53
|
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4}
|
|
53
|
-
post.likes.
|
|
54
|
+
expect(post.likes).to eq({'alice' => 1, 'bob' => 2, 'david' => 4})
|
|
54
55
|
end
|
|
55
56
|
|
|
56
57
|
it 'should cast keys when updating' do
|
|
57
58
|
post.likes[:david] = 4
|
|
58
|
-
post.likes.
|
|
59
|
+
expect(post.likes).to eq({'alice' => 1, 'bob' => 2, 'david' => 4})
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
it 'should cast values when updating' do
|
|
62
63
|
post.likes['david'] = 4.0
|
|
63
|
-
post.likes.
|
|
64
|
+
expect(post.likes).to eq({'alice' => 1, 'bob' => 2, 'david' => 4})
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
it 'should write without reading' do
|
|
@@ -73,8 +74,8 @@ describe Cequel::Record::Map do
|
|
|
73
74
|
|
|
74
75
|
it 'should set key value post-hoc' do
|
|
75
76
|
unloaded_post.likes['david'] = 4
|
|
76
|
-
unloaded_post.likes.
|
|
77
|
-
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4}
|
|
77
|
+
expect(unloaded_post.likes).to eq(
|
|
78
|
+
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4})
|
|
78
79
|
end
|
|
79
80
|
end
|
|
80
81
|
|
|
@@ -83,7 +84,7 @@ describe Cequel::Record::Map do
|
|
|
83
84
|
post.likes.clear
|
|
84
85
|
post.save
|
|
85
86
|
subject[:likes].should be_blank
|
|
86
|
-
post.likes.
|
|
87
|
+
expect(post.likes).to eq({})
|
|
87
88
|
end
|
|
88
89
|
|
|
89
90
|
it 'should clear without reading' do
|
|
@@ -104,12 +105,12 @@ describe Cequel::Record::Map do
|
|
|
104
105
|
post.likes.delete('bob')
|
|
105
106
|
post.save
|
|
106
107
|
subject[:likes].should == {'alice' => 1, 'charles' => 3}
|
|
107
|
-
post.likes.
|
|
108
|
+
expect(post.likes).to eq({'alice' => 1})
|
|
108
109
|
end
|
|
109
110
|
|
|
110
111
|
it 'should cast key before deleting' do
|
|
111
112
|
post.likes.delete(:bob)
|
|
112
|
-
post.likes.
|
|
113
|
+
expect(post.likes).to eq({'alice' => 1})
|
|
113
114
|
end
|
|
114
115
|
|
|
115
116
|
it 'should delete without reading' do
|
|
@@ -121,7 +122,7 @@ describe Cequel::Record::Map do
|
|
|
121
122
|
|
|
122
123
|
it 'should delete post-hoc' do
|
|
123
124
|
unloaded_post.likes.delete('bob')
|
|
124
|
-
unloaded_post.likes.
|
|
125
|
+
expect(unloaded_post.likes).to eq({'alice' => 1, 'charles' => 3})
|
|
125
126
|
end
|
|
126
127
|
end
|
|
127
128
|
|
|
@@ -131,15 +132,15 @@ describe Cequel::Record::Map do
|
|
|
131
132
|
post.save
|
|
132
133
|
subject[:likes].should ==
|
|
133
134
|
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5}
|
|
134
|
-
post.likes.
|
|
135
|
-
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5}
|
|
135
|
+
expect(post.likes).to eq(
|
|
136
|
+
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5})
|
|
136
137
|
end
|
|
137
138
|
|
|
138
139
|
it 'should cast keys before updating' do
|
|
139
140
|
post.likes.merge!(david: 4, emily: 5)
|
|
140
141
|
post.save
|
|
141
|
-
post.likes.
|
|
142
|
-
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5}
|
|
142
|
+
expect(post.likes).to eq(
|
|
143
|
+
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5})
|
|
143
144
|
end
|
|
144
145
|
|
|
145
146
|
it 'should cast values before updating' do
|
|
@@ -147,8 +148,8 @@ describe Cequel::Record::Map do
|
|
|
147
148
|
post.save
|
|
148
149
|
subject[:likes].should ==
|
|
149
150
|
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5}
|
|
150
|
-
post.likes.
|
|
151
|
-
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5}
|
|
151
|
+
expect(post.likes).to eq(
|
|
152
|
+
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5})
|
|
152
153
|
end
|
|
153
154
|
|
|
154
155
|
it 'should write without reading' do
|
|
@@ -161,8 +162,8 @@ describe Cequel::Record::Map do
|
|
|
161
162
|
|
|
162
163
|
it 'should merge post-hoc' do
|
|
163
164
|
unloaded_post.likes.merge!('david' => 4, 'emily' => 5)
|
|
164
|
-
unloaded_post.likes.
|
|
165
|
-
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5}
|
|
165
|
+
expect(unloaded_post.likes).to eq(
|
|
166
|
+
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5})
|
|
166
167
|
end
|
|
167
168
|
end
|
|
168
169
|
|
|
@@ -171,19 +172,19 @@ describe Cequel::Record::Map do
|
|
|
171
172
|
post.likes.replace('david' => 4, 'emily' => 5)
|
|
172
173
|
post.save
|
|
173
174
|
subject[:likes].should == {'david' => 4, 'emily' => 5}
|
|
174
|
-
post.likes.
|
|
175
|
+
expect(post.likes).to eq({'david' => 4, 'emily' => 5})
|
|
175
176
|
end
|
|
176
177
|
|
|
177
178
|
it 'should cast keys before overwriting' do
|
|
178
179
|
post.likes.replace(david: 4, emily: 5)
|
|
179
|
-
post.likes.
|
|
180
|
+
expect(post.likes).to eq({'david' => 4, 'emily' => 5})
|
|
180
181
|
end
|
|
181
182
|
|
|
182
183
|
it 'should cast values before overwriting' do
|
|
183
184
|
post.likes.replace('david' => '4', 'emily' => 5.0)
|
|
184
185
|
post.save
|
|
185
186
|
subject[:likes].should == {'david' => 4, 'emily' => 5}
|
|
186
|
-
post.likes.
|
|
187
|
+
expect(post.likes).to eq({'david' => 4, 'emily' => 5})
|
|
187
188
|
end
|
|
188
189
|
|
|
189
190
|
it 'should overwrite without reading' do
|
|
@@ -195,7 +196,7 @@ describe Cequel::Record::Map do
|
|
|
195
196
|
|
|
196
197
|
it 'should replace post-hoc' do
|
|
197
198
|
unloaded_post.likes.replace('david' => 4, 'emily' => 5)
|
|
198
|
-
unloaded_post.likes.
|
|
199
|
+
expect(unloaded_post.likes).to eq({'david' => 4, 'emily' => 5})
|
|
199
200
|
end
|
|
200
201
|
end
|
|
201
202
|
|
|
@@ -205,7 +206,7 @@ describe Cequel::Record::Map do
|
|
|
205
206
|
post.save
|
|
206
207
|
subject[:likes].should ==
|
|
207
208
|
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4}
|
|
208
|
-
post.likes.
|
|
209
|
+
expect(post.likes).to eq({'alice' => 1, 'bob' => 2, 'david' => 4})
|
|
209
210
|
end
|
|
210
211
|
|
|
211
212
|
it 'should write without reading' do
|
|
@@ -218,8 +219,8 @@ describe Cequel::Record::Map do
|
|
|
218
219
|
|
|
219
220
|
it 'should store post-hoc' do
|
|
220
221
|
unloaded_post.likes.store('david', 4)
|
|
221
|
-
unloaded_post.likes.
|
|
222
|
-
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4}
|
|
222
|
+
expect(unloaded_post.likes).to eq(
|
|
223
|
+
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4})
|
|
223
224
|
end
|
|
224
225
|
end
|
|
225
226
|
|
|
@@ -229,8 +230,8 @@ describe Cequel::Record::Map do
|
|
|
229
230
|
post.save
|
|
230
231
|
subject[:likes].should ==
|
|
231
232
|
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5}
|
|
232
|
-
post.likes.
|
|
233
|
-
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5}
|
|
233
|
+
expect(post.likes).to eq(
|
|
234
|
+
{'alice' => 1, 'bob' => 2, 'david' => 4, 'emily' => 5})
|
|
234
235
|
end
|
|
235
236
|
|
|
236
237
|
it 'should write without reading' do
|
|
@@ -243,8 +244,8 @@ describe Cequel::Record::Map do
|
|
|
243
244
|
|
|
244
245
|
it 'should update post-hoc' do
|
|
245
246
|
unloaded_post.likes.update('david' => 4, 'emily' => 5)
|
|
246
|
-
unloaded_post.likes.
|
|
247
|
-
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5}
|
|
247
|
+
expect(unloaded_post.likes).to eq(
|
|
248
|
+
{'alice' => 1, 'bob' => 2, 'charles' => 3, 'david' => 4, 'emily' => 5})
|
|
248
249
|
end
|
|
249
250
|
end
|
|
250
251
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
1
2
|
require File.expand_path('../spec_helper', __FILE__)
|
|
2
3
|
|
|
3
4
|
describe Cequel::Record::Properties do
|
|
@@ -57,59 +58,59 @@ describe Cequel::Record::Properties do
|
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
it 'should provide accessor for list column' do
|
|
60
|
-
Post.new { |post| post.tags = %w(one two three) }.tags.
|
|
61
|
-
|
|
61
|
+
expect(Post.new { |post| post.tags = %w(one two three) }.tags).to eq(
|
|
62
|
+
%w(one two three))
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
it 'should cast collection in list column to list' do
|
|
65
|
-
Post.new { |post| post.tags = Set['1', '2', '3'] }.tags
|
|
66
|
-
|
|
66
|
+
expect(Post.new { |post| post.tags = Set['1', '2', '3'] }.tags)
|
|
67
|
+
.to eq(%w(1 2 3))
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
it 'should cast elements in list' do
|
|
70
|
-
Post.new { |post| post.tags = [1, 2, 3] }.tags.
|
|
71
|
+
expect(Post.new { |post| post.tags = [1, 2, 3] }.tags).to eq(%w(1 2 3))
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
it 'should have empty list column value if unset' do
|
|
74
|
-
Post.new.tags.
|
|
75
|
+
expect(Post.new.tags).to eq([])
|
|
75
76
|
end
|
|
76
77
|
|
|
77
78
|
it 'should provide accessor for set column' do
|
|
78
|
-
Post.new { |post| post.categories = Set['Big Data', 'Cassandra'] }
|
|
79
|
-
categories.
|
|
79
|
+
expect(Post.new { |post| post.categories = Set['Big Data', 'Cassandra'] }
|
|
80
|
+
.categories).to eq(Set['Big Data', 'Cassandra'])
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
it 'should cast values in set column to correct type' do
|
|
83
|
-
Post.new { |post| post.categories = Set[1, 2, 3] }.categories
|
|
84
|
-
|
|
84
|
+
expect(Post.new { |post| post.categories = Set[1, 2, 3] }.categories)
|
|
85
|
+
.to eq(Set['1', '2', '3'])
|
|
85
86
|
end
|
|
86
87
|
|
|
87
88
|
it 'should cast collection to set in set column' do
|
|
88
|
-
Post.new { |post| post.categories = ['1', '2', '3'] }.categories
|
|
89
|
-
|
|
89
|
+
expect(Post.new { |post| post.categories = ['1', '2', '3'] }.categories)
|
|
90
|
+
.to eq(Set['1', '2', '3'])
|
|
90
91
|
end
|
|
91
92
|
|
|
92
93
|
it 'should have empty set column value if present' do
|
|
93
|
-
Post.new.categories.
|
|
94
|
+
expect(Post.new.categories).to eq(Set[])
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
it 'should provide accessor for map column' do
|
|
97
|
-
Post.new { |post| post.shares = {'facebook' => 1, 'twitter' => 2}}
|
|
98
|
-
shares.
|
|
98
|
+
expect(Post.new { |post| post.shares = {'facebook' => 1, 'twitter' => 2}}
|
|
99
|
+
.shares).to eq({'facebook' => 1, 'twitter' => 2})
|
|
99
100
|
end
|
|
100
101
|
|
|
101
102
|
it 'should cast values for map column' do
|
|
102
|
-
Post.new { |post| post.shares = {facebook: '1', twitter: '2'} }
|
|
103
|
-
shares.
|
|
103
|
+
expect(Post.new { |post| post.shares = {facebook: '1', twitter: '2'} }
|
|
104
|
+
.shares).to eq({'facebook' => 1, 'twitter' => 2})
|
|
104
105
|
end
|
|
105
106
|
|
|
106
107
|
it 'should cast collection passed to map column to map' do
|
|
107
|
-
Post.new { |post| post.shares = [['facebook', 1], ['twitter', 2]] }
|
|
108
|
-
shares.
|
|
108
|
+
expect(Post.new { |post| post.shares = [['facebook', 1], ['twitter', 2]] }
|
|
109
|
+
.shares).to eq({'facebook' => 1, 'twitter' => 2})
|
|
109
110
|
end
|
|
110
111
|
|
|
111
112
|
it 'should set map column to empty hash by default' do
|
|
112
|
-
Post.new.shares.
|
|
113
|
+
expect(Post.new.shares).to eq({})
|
|
113
114
|
end
|
|
114
115
|
end
|
|
115
116
|
|
|
@@ -127,15 +128,15 @@ describe Cequel::Record::Properties do
|
|
|
127
128
|
end
|
|
128
129
|
|
|
129
130
|
it 'should respect default for list column' do
|
|
130
|
-
Post.new.tags.
|
|
131
|
+
expect(Post.new.tags).to eq(['new'])
|
|
131
132
|
end
|
|
132
133
|
|
|
133
134
|
it 'should respect default for set column' do
|
|
134
|
-
Post.new.categories.
|
|
135
|
+
expect(Post.new.categories).to eq(Set['Big Data'])
|
|
135
136
|
end
|
|
136
137
|
|
|
137
138
|
it 'should respect default for map column' do
|
|
138
|
-
Post.new.shares.
|
|
139
|
+
expect(Post.new.shares).to eq({'facebook' => 0})
|
|
139
140
|
end
|
|
140
141
|
end
|
|
141
142
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
1
2
|
require File.expand_path('../spec_helper', __FILE__)
|
|
2
3
|
|
|
3
4
|
describe Cequel::Record::Set do
|
|
@@ -49,12 +50,12 @@ describe Cequel::Record::Set do
|
|
|
49
50
|
post.tags.add('four')
|
|
50
51
|
post.save
|
|
51
52
|
subject[:tags].should == Set['one', 'two', 'three', 'four']
|
|
52
|
-
post.tags.
|
|
53
|
+
expect(post.tags).to eq(Set['one', 'two', 'four'])
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
it 'should cast before adding' do
|
|
56
57
|
post.tags.add(4)
|
|
57
|
-
post.tags.
|
|
58
|
+
expect(post.tags).to eq(Set['one', 'two', '4'])
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
it 'should add without reading' do
|
|
@@ -66,7 +67,7 @@ describe Cequel::Record::Set do
|
|
|
66
67
|
|
|
67
68
|
it 'should apply add post-hoc' do
|
|
68
69
|
unloaded_post.tags.add('four')
|
|
69
|
-
unloaded_post.tags.
|
|
70
|
+
expect(unloaded_post.tags).to eq(Set['one', 'two', 'three', 'four'])
|
|
70
71
|
end
|
|
71
72
|
end
|
|
72
73
|
|
|
@@ -75,7 +76,7 @@ describe Cequel::Record::Set do
|
|
|
75
76
|
post.tags.clear
|
|
76
77
|
post.save
|
|
77
78
|
subject[:tags].should be_blank
|
|
78
|
-
post.tags.
|
|
79
|
+
expect(post.tags).to eq(Set[])
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
it 'should clear without reading' do
|
|
@@ -87,7 +88,7 @@ describe Cequel::Record::Set do
|
|
|
87
88
|
|
|
88
89
|
it 'should apply clear post-hoc' do
|
|
89
90
|
unloaded_post.tags.clear
|
|
90
|
-
unloaded_post.tags.
|
|
91
|
+
expect(unloaded_post.tags).to eq(Set[])
|
|
91
92
|
end
|
|
92
93
|
end
|
|
93
94
|
|
|
@@ -96,12 +97,12 @@ describe Cequel::Record::Set do
|
|
|
96
97
|
post.tags.delete('two')
|
|
97
98
|
post.save
|
|
98
99
|
subject[:tags].should == Set['one', 'three']
|
|
99
|
-
post.tags.
|
|
100
|
+
expect(post.tags).to eq(Set['one'])
|
|
100
101
|
end
|
|
101
102
|
|
|
102
103
|
it 'should cast before deleting' do
|
|
103
104
|
post.tags.delete(:two)
|
|
104
|
-
post.tags.
|
|
105
|
+
expect(post.tags).to eq(Set['one'])
|
|
105
106
|
end
|
|
106
107
|
|
|
107
108
|
it 'should delete without reading' do
|
|
@@ -113,7 +114,7 @@ describe Cequel::Record::Set do
|
|
|
113
114
|
|
|
114
115
|
it 'should apply delete post-hoc' do
|
|
115
116
|
unloaded_post.tags.delete('two')
|
|
116
|
-
unloaded_post.tags.
|
|
117
|
+
expect(unloaded_post.tags).to eq(Set['one', 'three'])
|
|
117
118
|
end
|
|
118
119
|
end
|
|
119
120
|
|
|
@@ -122,12 +123,12 @@ describe Cequel::Record::Set do
|
|
|
122
123
|
post.tags.replace(Set['a', 'b'])
|
|
123
124
|
post.save
|
|
124
125
|
subject[:tags].should == Set['a', 'b']
|
|
125
|
-
post.tags.
|
|
126
|
+
expect(post.tags).to eq(Set['a', 'b'])
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
it 'should cast before replacing' do
|
|
129
130
|
post.tags.replace(Set[1, 2, :three])
|
|
130
|
-
post.tags.
|
|
131
|
+
expect(post.tags).to eq(Set['1', '2', 'three'])
|
|
131
132
|
end
|
|
132
133
|
|
|
133
134
|
it 'should replace without reading' do
|
|
@@ -139,7 +140,7 @@ describe Cequel::Record::Set do
|
|
|
139
140
|
|
|
140
141
|
it 'should apply delete post-hoc' do
|
|
141
142
|
unloaded_post.tags.replace(Set['a', 'b'])
|
|
142
|
-
unloaded_post.tags.
|
|
143
|
+
expect(unloaded_post.tags).to eq(Set['a', 'b'])
|
|
143
144
|
end
|
|
144
145
|
end
|
|
145
146
|
|