cequel 1.4.2 → 1.4.3

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +19 -12
  4. data/Rakefile +5 -1
  5. data/lib/cequel/record/data_set_builder.rb +9 -2
  6. data/lib/cequel/record/record_set.rb +16 -2
  7. data/lib/cequel/record/tasks.rb +6 -2
  8. data/lib/cequel/version.rb +1 -1
  9. data/spec/examples/metal/data_set_spec.rb +113 -106
  10. data/spec/examples/metal/keyspace_spec.rb +7 -15
  11. data/spec/examples/record/associations_spec.rb +30 -30
  12. data/spec/examples/record/callbacks_spec.rb +25 -25
  13. data/spec/examples/record/dirty_spec.rb +11 -10
  14. data/spec/examples/record/list_spec.rb +33 -33
  15. data/spec/examples/record/map_spec.rb +57 -41
  16. data/spec/examples/record/mass_assignment_spec.rb +5 -5
  17. data/spec/examples/record/naming_spec.rb +2 -2
  18. data/spec/examples/record/persistence_spec.rb +23 -23
  19. data/spec/examples/record/properties_spec.rb +19 -19
  20. data/spec/examples/record/record_set_spec.rb +155 -151
  21. data/spec/examples/record/schema_spec.rb +7 -7
  22. data/spec/examples/record/scoped_spec.rb +2 -2
  23. data/spec/examples/record/serialization_spec.rb +2 -2
  24. data/spec/examples/record/set_spec.rb +27 -23
  25. data/spec/examples/record/validations_spec.rb +13 -13
  26. data/spec/examples/schema/table_reader_spec.rb +85 -79
  27. data/spec/examples/schema/table_synchronizer_spec.rb +9 -9
  28. data/spec/examples/schema/table_updater_spec.rb +17 -17
  29. data/spec/examples/schema/table_writer_spec.rb +33 -33
  30. data/spec/examples/type_spec.rb +55 -55
  31. data/spec/support/helpers.rb +18 -10
  32. metadata +18 -5
  33. data/spec/shared/readable_dictionary.rb +0 -192
@@ -21,13 +21,13 @@ describe Cequel::Metal::Keyspace do
21
21
 
22
22
  describe '::batch' do
23
23
  it 'should send enclosed write statements in bulk' do
24
- expect(cequel).to receive(:execute).once.and_call_original
25
- cequel.batch do
26
- cequel[:posts].insert(id: 1, title: 'Hey')
27
- cequel[:posts].where(id: 1).update(body: 'Body')
28
- cequel[:posts].where(id: 1).delete(:title)
24
+ expect_statement_count 1 do
25
+ cequel.batch do
26
+ cequel[:posts].insert(id: 1, title: 'Hey')
27
+ cequel[:posts].where(id: 1).update(body: 'Body')
28
+ cequel[:posts].where(id: 1).delete(:title)
29
+ end
29
30
  end
30
- RSpec::Mocks.proxy_for(cequel).reset
31
31
  expect(cequel[:posts].first).to eq({id: 1, title: nil, body: 'Body'}
32
32
  .with_indifferent_access)
33
33
  end
@@ -96,20 +96,12 @@ describe Cequel::Metal::Keyspace do
96
96
  end
97
97
 
98
98
  context "with a connection error" do
99
- after(:each) do
100
- RSpec::Mocks.proxy_for(cequel).reset
101
- end
102
-
103
99
  it "reconnects to cassandra with a new client after first failed connection" do
104
- allow(cequel).to receive(:execute_with_consistency)
100
+ allow(cequel.client).to receive(:execute_with_consistency)
105
101
  .with(statement, [], nil)
106
102
  .and_raise(Ione::Io::ConnectionError)
107
103
  .once
108
104
 
109
- expect(cequel).to receive(:execute_with_consistency)
110
- .with(statement, [], :quorum)
111
- .once
112
-
113
105
  expect { cequel.execute(statement) }.not_to raise_error
114
106
  end
115
107
  end
@@ -55,29 +55,29 @@ describe Cequel::Record::Associations do
55
55
  let(:post) { Post.new }
56
56
 
57
57
  it 'should add parent key as first key' do
58
- Post.key_column_names.first.should == :blog_subdomain
58
+ expect(Post.key_column_names.first).to eq(:blog_subdomain)
59
59
  end
60
60
 
61
61
  it 'should add parent key as the partition key' do
62
- Post.partition_key_column_names.should == [:blog_subdomain]
62
+ expect(Post.partition_key_column_names).to eq([:blog_subdomain])
63
63
  end
64
64
 
65
65
  it "should add parent's keys as first keys" do
66
- Comment.key_column_names.first(2).should == [:post_blog_subdomain, :post_id]
66
+ expect(Comment.key_column_names.first(2)).to eq([:post_blog_subdomain, :post_id])
67
67
  end
68
68
 
69
69
  it "should add parent's first key as partition key" do
70
- Comment.partition_key_column_names.should == [:post_blog_subdomain]
70
+ expect(Comment.partition_key_column_names).to eq([:post_blog_subdomain])
71
71
  end
72
72
 
73
73
  it 'should provide accessors for association object' do
74
74
  post.blog = blog
75
- post.blog.should == blog
75
+ expect(post.blog).to eq(blog)
76
76
  end
77
77
 
78
78
  it 'should set parent key(s) when setting association object' do
79
79
  post.blog = blog
80
- post.blog_subdomain.should == 'big-data'
80
+ expect(post.blog_subdomain).to eq('big-data')
81
81
  end
82
82
 
83
83
  it 'should raise ArgumentError when parent is set without keys' do
@@ -91,13 +91,13 @@ describe Cequel::Record::Associations do
91
91
 
92
92
  it 'should return Blog instance when parent key set directly' do
93
93
  post.blog_subdomain = 'big-data'
94
- post.blog.subdomain.should == 'big-data'
94
+ expect(post.blog.subdomain).to eq('big-data')
95
95
  end
96
96
 
97
97
  it 'should not hydrate parent instance when creating from key' do
98
98
  post.blog_subdomain = 'big-data'
99
99
  disallow_queries!
100
- post.blog.should_not be_loaded
100
+ expect(post.blog).not_to be_loaded
101
101
  end
102
102
 
103
103
  it 'should not allow declaring belongs_to after key' do
@@ -125,22 +125,22 @@ describe Cequel::Record::Associations do
125
125
  let(:photo) { Photo.new }
126
126
 
127
127
  it "should add parent's keys as first keys" do
128
- Photo.key_column_names.first(2).should == [:post_blog_subdomain, :post_id]
128
+ expect(Photo.key_column_names.first(2)).to eq([:post_blog_subdomain, :post_id])
129
129
  end
130
130
 
131
131
  it "should add parent's keys as partition keys" do
132
- Photo.partition_key_column_names.should == [:post_blog_subdomain, :post_id]
132
+ expect(Photo.partition_key_column_names).to eq([:post_blog_subdomain, :post_id])
133
133
  end
134
134
 
135
135
  it 'should provide accessors for association object' do
136
136
  photo.post = post
137
- photo.post.should == post
137
+ expect(photo.post).to eq(post)
138
138
  end
139
139
 
140
140
  it 'should set parent key(s) when setting association object' do
141
141
  photo.post = post
142
- photo.post_blog_subdomain.should == 'big-data'
143
- photo.post_id.should == post.id
142
+ expect(photo.post_blog_subdomain).to eq('big-data')
143
+ expect(photo.post_id).to eq(post.id)
144
144
  end
145
145
 
146
146
  it 'should raise ArgumentError when parent is set without a key' do
@@ -155,14 +155,14 @@ describe Cequel::Record::Associations do
155
155
  it 'should return Photo instance when parent keys are set directly' do
156
156
  photo.post_blog_subdomain = 'big-data'
157
157
  photo.post_id = post.id
158
- photo.post.should == post
158
+ expect(photo.post).to eq(post)
159
159
  end
160
160
 
161
161
  it 'should not hydrate parent instance when creating from keys' do
162
162
  photo.post_blog_subdomain = 'big-data'
163
163
  photo.post_id = post.id
164
164
  disallow_queries!
165
- photo.post.should_not be_loaded
165
+ expect(photo.post).not_to be_loaded
166
166
  end
167
167
 
168
168
  it 'should not allow declaring belongs_to after key' do
@@ -208,32 +208,32 @@ describe Cequel::Record::Associations do
208
208
  end
209
209
 
210
210
  it 'should return scope of posts' do
211
- blog.posts.map(&:title).should == ["Post 0", "Post 1", "Post 2"]
211
+ expect(blog.posts.map(&:title)).to eq(["Post 0", "Post 1", "Post 2"])
212
212
  end
213
213
 
214
214
  it 'should retain scope when hydrated multiple times' do
215
215
  blog.posts.map(&:id)
216
216
  disallow_queries!
217
- blog.posts.map(&:title).should == ["Post 0", "Post 1", "Post 2"]
217
+ expect(blog.posts.map(&:title)).to eq(["Post 0", "Post 1", "Post 2"])
218
218
  end
219
219
 
220
220
  it 'should reload when reload argument passed' do
221
221
  blog.posts.map(&:id)
222
222
  posts.first.destroy
223
- blog.posts(true).map(&:title).should == ['Post 1', 'Post 2']
223
+ expect(blog.posts(true).map(&:title)).to eq(['Post 1', 'Post 2'])
224
224
  end
225
225
 
226
226
  it 'should support #find with key' do
227
- blog.posts.find(posts.first.id).should == posts.first
227
+ expect(blog.posts.find(posts.first.id)).to eq(posts.first)
228
228
  end
229
229
 
230
230
  it 'should support #find with block' do
231
- blog.posts.find { |post| post.title.include?('1') }.should == posts[1]
231
+ expect(blog.posts.find { |post| post.title.include?('1') }).to eq(posts[1])
232
232
  end
233
233
 
234
234
  it 'should support #select with block' do
235
- blog.posts.select { |post| !post.title.include?('2') }
236
- .should == posts.first(2)
235
+ expect(blog.posts.select { |post| !post.title.include?('2') })
236
+ .to eq(posts.first(2))
237
237
  end
238
238
 
239
239
  it 'should support #select with arguments' do
@@ -243,35 +243,35 @@ describe Cequel::Record::Associations do
243
243
 
244
244
  it 'should load #first directly from the database if unloaded' do
245
245
  blog.posts.first.title
246
- blog.posts.should_not be_loaded
246
+ expect(blog.posts).not_to be_loaded
247
247
  end
248
248
 
249
249
  it 'should read #first from loaded collection' do
250
250
  blog.posts.entries
251
251
  disallow_queries!
252
- blog.posts.first.title.should == 'Post 0'
252
+ expect(blog.posts.first.title).to eq('Post 0')
253
253
  end
254
254
 
255
255
  it 'should always query the database for #count' do
256
256
  blog.posts.entries
257
257
  posts.first.destroy
258
- blog.posts.count.should == 2
258
+ expect(blog.posts.count).to eq(2)
259
259
  end
260
260
 
261
261
  it 'should always load the records for #length' do
262
- blog.posts.length.should == 3
263
- blog.posts.should be_loaded
262
+ expect(blog.posts.length).to eq(3)
263
+ expect(blog.posts).to be_loaded
264
264
  end
265
265
 
266
266
  it 'should count from database for #size if unloaded' do
267
- blog.posts.size.should == 3
268
- blog.posts.should_not be_loaded
267
+ expect(blog.posts.size).to eq(3)
268
+ expect(blog.posts).not_to be_loaded
269
269
  end
270
270
 
271
271
  it 'should count records in memory for #size if loaded' do
272
272
  blog.posts.entries
273
273
  disallow_queries!
274
- blog.posts.size.should == 3
274
+ expect(blog.posts.size).to eq(3)
275
275
  end
276
276
 
277
277
  it "does not allow invalid :dependent options" do
@@ -68,28 +68,28 @@ describe Cequel::Record::Callbacks do
68
68
  before { new_post.save! }
69
69
  subject { new_post.executed_callbacks }
70
70
 
71
- it { should include(:before_save) }
72
- it { should include(:after_save) }
73
- it { should include(:before_create) }
74
- it { should include(:after_create) }
75
- it { should_not include(:before_update) }
76
- it { should_not include(:after_update) }
77
- it { should_not include(:before_destroy) }
78
- it { should_not include(:after_destroy) }
71
+ it { is_expected.to include(:before_save) }
72
+ it { is_expected.to include(:after_save) }
73
+ it { is_expected.to include(:before_create) }
74
+ it { is_expected.to include(:after_create) }
75
+ it { is_expected.not_to include(:before_update) }
76
+ it { is_expected.not_to include(:after_update) }
77
+ it { is_expected.not_to include(:before_destroy) }
78
+ it { is_expected.not_to include(:after_destroy) }
79
79
  end
80
80
 
81
81
  context 'on update' do
82
82
  before { existing_post.save! }
83
83
  subject { existing_post.executed_callbacks }
84
84
 
85
- it { should include(:before_save) }
86
- it { should include(:after_save) }
87
- it { should_not include(:before_create) }
88
- it { should_not include(:after_create) }
89
- it { should include(:before_update) }
90
- it { should include(:after_update) }
91
- it { should_not include(:before_destroy) }
92
- it { should_not include(:after_destroy) }
85
+ it { is_expected.to include(:before_save) }
86
+ it { is_expected.to include(:after_save) }
87
+ it { is_expected.not_to include(:before_create) }
88
+ it { is_expected.not_to include(:after_create) }
89
+ it { is_expected.to include(:before_update) }
90
+ it { is_expected.to include(:after_update) }
91
+ it { is_expected.not_to include(:before_destroy) }
92
+ it { is_expected.not_to include(:after_destroy) }
93
93
  end
94
94
 
95
95
  context 'on destroy' do
@@ -97,14 +97,14 @@ describe Cequel::Record::Callbacks do
97
97
 
98
98
  subject { existing_post.executed_callbacks }
99
99
 
100
- it { should_not include(:before_save) }
101
- it { should_not include(:after_save) }
102
- it { should_not include(:before_create) }
103
- it { should_not include(:after_create) }
104
- it { should_not include(:before_update) }
105
- it { should_not include(:after_update) }
106
- it { should include(:before_destroy) }
107
- it { should include(:after_destroy) }
100
+ it { is_expected.not_to include(:before_save) }
101
+ it { is_expected.not_to include(:after_save) }
102
+ it { is_expected.not_to include(:before_create) }
103
+ it { is_expected.not_to include(:after_create) }
104
+ it { is_expected.not_to include(:before_update) }
105
+ it { is_expected.not_to include(:after_update) }
106
+ it { is_expected.to include(:before_destroy) }
107
+ it { is_expected.to include(:after_destroy) }
108
108
  end
109
109
 
110
110
  describe 'atomic writes' do
@@ -114,7 +114,7 @@ describe Cequel::Record::Callbacks do
114
114
  -> { expect { Post.find('autopost') }.
115
115
  to raise_error(Cequel::Record::RecordNotFound) }
116
116
  comment.save!
117
- Post.find('autopost').title.should == 'Auto Post'
117
+ expect(Post.find('autopost').title).to eq('Auto Post')
118
118
  end
119
119
  end
120
120
  end
@@ -18,43 +18,44 @@ describe Cequel::Record::Dirty do
18
18
  end
19
19
 
20
20
  it 'should not have changed attributes by default' do
21
- post.changed_attributes.should be_empty
21
+ expect(post.changed_attributes).to be_empty
22
22
  end
23
23
 
24
24
  it 'should have changed attributes if attributes change' do
25
25
  post.title = 'Cequel ORM'
26
- post.changed_attributes.
27
- should == {:title => 'Cequel'}.with_indifferent_access
26
+ expect(post.changed_attributes).
27
+ to eq({:title => 'Cequel'}.with_indifferent_access)
28
28
  end
29
29
 
30
30
  it 'should not have changed attributes if attribute set to the same thing' do
31
31
  post.title = 'Cequel'
32
- post.changed_attributes.should be_empty
32
+ expect(post.changed_attributes).to be_empty
33
33
  end
34
34
 
35
35
  it 'should support *_changed? method' do
36
36
  post.title = 'Cequel ORM'
37
- post.title_changed?.should be_true
37
+ expect(post.title_changed?).to eq(true)
38
38
  end
39
39
 
40
40
  it 'should not have changed attributes after save' do
41
41
  post.title = 'Cequel ORM'
42
42
  post.save
43
- post.changed_attributes.should be_empty
43
+ expect(post.changed_attributes).to be_empty
44
44
  end
45
45
 
46
46
  it 'should have previous changes after save' do
47
47
  post.title = 'Cequel ORM'
48
48
  post.save
49
- post.previous_changes.
50
- should == { :title => ['Cequel', 'Cequel ORM'] }.with_indifferent_access
49
+ expect(post.previous_changes).
50
+ to eq({ :title => ['Cequel', 'Cequel ORM'] }.with_indifferent_access)
51
51
  end
52
52
 
53
53
  it 'should detect changes to collections' do
54
54
  post.categories << 'Gems'
55
- post.changes.should ==
55
+ expect(post.changes).to eq(
56
56
  {categories: [Set['Libraries'], Set['Libraries', 'Gems']]}.
57
57
  with_indifferent_access
58
+ )
58
59
  end
59
60
  end
60
61
 
@@ -63,7 +64,7 @@ describe Cequel::Record::Dirty do
63
64
 
64
65
  it 'should not track changes' do
65
66
  post.title = 'Cequel'
66
- post.changes.should be_empty
67
+ expect(post.changes).to be_empty
67
68
  end
68
69
  end
69
70
  end
@@ -26,7 +26,7 @@ describe Cequel::Record::List do
26
26
 
27
27
  context 'new record' do
28
28
  it 'should save list as-is' do
29
- subject[:tags].should == %w(one two)
29
+ expect(subject[:tags]).to eq(%w(one two))
30
30
  end
31
31
  end
32
32
 
@@ -34,13 +34,13 @@ describe Cequel::Record::List do
34
34
  it 'should overwrite value' do
35
35
  post.tags = %w(three four)
36
36
  post.save!
37
- subject[:tags].should == %w(three four)
37
+ expect(subject[:tags]).to eq(%w(three four))
38
38
  end
39
39
 
40
40
  it 'should cast collection before overwriting' do
41
41
  post.tags = Set['three', 'four']
42
42
  post.save!
43
- subject[:tags].should == %w(three four)
43
+ expect(subject[:tags]).to eq(%w(three four))
44
44
  end
45
45
  end
46
46
 
@@ -48,21 +48,21 @@ describe Cequel::Record::List do
48
48
  it 'should add new items' do
49
49
  post.tags << 'three' << 'four'
50
50
  post.save
51
- subject[:tags].should == %w(one two three four)
51
+ expect(subject[:tags]).to eq(%w(one two three four))
52
52
  end
53
53
 
54
54
  it 'should add new items atomically' do
55
55
  scope.list_append(:tags, 'three')
56
56
  post.tags << 'four' << 'five'
57
57
  post.save
58
- subject[:tags].should == %w(one two three four five)
58
+ expect(subject[:tags]).to eq(%w(one two three four five))
59
59
  end
60
60
 
61
61
  it 'should add new items without reading' do
62
62
  unloaded_post.tags << 'four' << 'five'
63
63
  unloaded_post.save
64
- unloaded_post.should_not be_loaded
65
- subject[:tags].should == %w(one two four five)
64
+ expect(unloaded_post).not_to be_loaded
65
+ expect(subject[:tags]).to eq(%w(one two four five))
66
66
  end
67
67
 
68
68
  it 'should load itself and then add new items in memory when unloaded' do
@@ -82,7 +82,7 @@ describe Cequel::Record::List do
82
82
  it 'should atomically replace a single element' do
83
83
  post.tags[1] = 'TWO'
84
84
  post.save
85
- subject[:tags].should == %w(one TWO three)
85
+ expect(subject[:tags]).to eq(%w(one TWO three))
86
86
  expect(post.tags).to eq(%w(one TWO))
87
87
  end
88
88
 
@@ -92,14 +92,14 @@ describe Cequel::Record::List do
92
92
  end
93
93
 
94
94
  it 'should replace an element without reading' do
95
- cequel.should_not_receive :execute
95
+ disallow_queries!
96
96
  unloaded_post.tags[1] = 'TWO'
97
97
  end
98
98
 
99
99
  it 'should persist the replaced element' do
100
100
  unloaded_post.tags[1] = 'TWO'
101
101
  unloaded_post.save
102
- subject[:tags].should == %w(one TWO three)
102
+ expect(subject[:tags]).to eq(%w(one TWO three))
103
103
  end
104
104
 
105
105
  it 'should apply local modifications when loaded later' do
@@ -110,7 +110,7 @@ describe Cequel::Record::List do
110
110
  it 'should atomically replace a given number of arguments' do
111
111
  post.tags[0, 2] = 'One', 'Two'
112
112
  post.save
113
- subject[:tags].should == %w(One Two three)
113
+ expect(subject[:tags]).to eq(%w(One Two three))
114
114
  expect(post.tags).to eq(%w(One Two))
115
115
  end
116
116
 
@@ -123,14 +123,14 @@ describe Cequel::Record::List do
123
123
  scope.list_append(:tags, 'four')
124
124
  post.tags[0, 3] = 'ONE'
125
125
  post.save
126
- subject[:tags].should == %w(ONE four)
126
+ expect(subject[:tags]).to eq(%w(ONE four))
127
127
  expect(post.tags).to eq(%w(ONE))
128
128
  end
129
129
 
130
130
  it 'should atomically replace a given range of elements' do
131
131
  post.tags[0..1] = ['One', 'Two']
132
132
  post.save
133
- subject[:tags].should == %w(One Two three)
133
+ expect(subject[:tags]).to eq(%w(One Two three))
134
134
  expect(post.tags).to eq(%w(One Two))
135
135
  end
136
136
 
@@ -138,7 +138,7 @@ describe Cequel::Record::List do
138
138
  scope.list_append(:tags, 'four')
139
139
  post.tags[0..2] = 'ONE'
140
140
  post.save
141
- subject[:tags].should == %w(ONE four)
141
+ expect(subject[:tags]).to eq(%w(ONE four))
142
142
  expect(post.tags).to eq(%w(ONE))
143
143
  end
144
144
  end
@@ -147,19 +147,19 @@ describe Cequel::Record::List do
147
147
  it 'should clear all elements from the array' do
148
148
  post.tags.clear
149
149
  post.save
150
- subject[:tags].should be_blank
150
+ expect(subject[:tags]).to be_blank
151
151
  expect(post.tags).to eq([])
152
152
  end
153
153
 
154
154
  it 'should clear elements without loading' do
155
- cequel.should_not receive(:execute)
155
+ expect(cequel).not_to receive(:execute)
156
156
  unloaded_post.tags.clear
157
157
  end
158
158
 
159
159
  it 'should persist clear without loading' do
160
160
  unloaded_post.tags.clear
161
161
  unloaded_post.save
162
- subject[:tags].should be_blank
162
+ expect(subject[:tags]).to be_blank
163
163
  end
164
164
 
165
165
  it 'should apply local modifications post-hoc' do
@@ -179,7 +179,7 @@ describe Cequel::Record::List do
179
179
  scope.list_append(:tags, 'three')
180
180
  post.tags.concat(['four', 'five'])
181
181
  post.save
182
- subject[:tags].should == %w(one two three four five)
182
+ expect(subject[:tags]).to eq(%w(one two three four five))
183
183
  expect(post.tags).to eq(%w(one two four five))
184
184
  end
185
185
 
@@ -189,14 +189,14 @@ describe Cequel::Record::List do
189
189
  end
190
190
 
191
191
  it 'should concat elements without loading' do
192
- cequel.should_not_receive :execute
192
+ disallow_queries!
193
193
  unloaded_post.tags.concat(['four', 'five'])
194
194
  end
195
195
 
196
196
  it 'should persist concatenated elements' do
197
197
  unloaded_post.tags.concat(['four', 'five'])
198
198
  unloaded_post.save
199
- subject[:tags].should == %w(one two four five)
199
+ expect(subject[:tags]).to eq(%w(one two four five))
200
200
  end
201
201
 
202
202
  it 'should apply local modifications when loaded later' do
@@ -211,7 +211,7 @@ describe Cequel::Record::List do
211
211
  scope.list_append(:tags, 'two')
212
212
  post.tags.delete('two')
213
213
  post.save
214
- subject[:tags].should == %w(one three)
214
+ expect(subject[:tags]).to eq(%w(one three))
215
215
  expect(post.tags).to eq(%w(one))
216
216
  end
217
217
 
@@ -221,14 +221,14 @@ describe Cequel::Record::List do
221
221
  end
222
222
 
223
223
  it 'should delete without loading' do
224
- cequel.should_not_receive :execute
224
+ disallow_queries!
225
225
  unloaded_post.tags.delete('two')
226
226
  end
227
227
 
228
228
  it 'should persist deletions without loading' do
229
229
  unloaded_post.tags.delete('two')
230
230
  unloaded_post.save
231
- subject[:tags].should == %w(one)
231
+ expect(subject[:tags]).to eq(%w(one))
232
232
  end
233
233
 
234
234
  it 'should modify local copy after the fact' do
@@ -242,19 +242,19 @@ describe Cequel::Record::List do
242
242
  scope.list_append(:tags, ['three', 'four'])
243
243
  post.tags.delete_at(1)
244
244
  post.save
245
- subject[:tags].should == %w(one three four)
245
+ expect(subject[:tags]).to eq(%w(one three four))
246
246
  expect(post.tags).to eq(%w(one))
247
247
  end
248
248
 
249
249
  it 'should delete from a given index without reading' do
250
- cequel.should_not_receive :execute
250
+ disallow_queries!
251
251
  unloaded_post.tags.delete_at(1)
252
252
  end
253
253
 
254
254
  it 'should persist deletion from unloaded list' do
255
255
  unloaded_post.tags.delete_at(1)
256
256
  unloaded_post.save
257
- subject[:tags].should == %w(one)
257
+ expect(subject[:tags]).to eq(%w(one))
258
258
  end
259
259
 
260
260
  it 'should apply deletion after the fact' do
@@ -313,7 +313,7 @@ describe Cequel::Record::List do
313
313
  scope.list_append(:tags, 'three')
314
314
  post.tags.push('four').push('five')
315
315
  post.save
316
- subject[:tags].should == %w(one two three four five)
316
+ expect(subject[:tags]).to eq(%w(one two three four five))
317
317
  expect(post.tags).to eq(%w(one two four five))
318
318
  end
319
319
  end
@@ -330,7 +330,7 @@ describe Cequel::Record::List do
330
330
  scope.list_append(:tags, 'three')
331
331
  post.tags.replace(%w(four five))
332
332
  post.save
333
- subject[:tags].should == %w(four five)
333
+ expect(subject[:tags]).to eq(%w(four five))
334
334
  expect(post.tags).to eq(%w(four five))
335
335
  end
336
336
 
@@ -340,14 +340,14 @@ describe Cequel::Record::List do
340
340
  end
341
341
 
342
342
  it 'should overwrite without reading' do
343
- cequel.should_not_receive :execute
343
+ disallow_queries!
344
344
  unloaded_post.tags.replace(%w(four five))
345
345
  end
346
346
 
347
347
  it 'should persist unloaded overwrite' do
348
348
  unloaded_post.tags.replace(%w(four five))
349
349
  unloaded_post.save
350
- subject[:tags].should == %w(four five)
350
+ expect(subject[:tags]).to eq(%w(four five))
351
351
  end
352
352
 
353
353
  it 'should apply replace post-hoc' do
@@ -417,7 +417,7 @@ describe Cequel::Record::List do
417
417
  scope.list_prepend(:tags, 'zero')
418
418
  post.tags.unshift('minustwo', 'minusone')
419
419
  post.save
420
- subject[:tags].should == %w(minustwo minusone zero one two)
420
+ expect(subject[:tags]).to eq(%w(minustwo minusone zero one two))
421
421
  expect(post.tags).to eq(%w(minustwo minusone one two))
422
422
  end
423
423
 
@@ -427,14 +427,14 @@ describe Cequel::Record::List do
427
427
  end
428
428
 
429
429
  it 'should unshift without reading' do
430
- cequel.should_not_receive :execute
430
+ disallow_queries!
431
431
  unloaded_post.tags.unshift('minustwo', 'minusone')
432
432
  end
433
433
 
434
434
  it 'should persist unloaded unshift' do
435
435
  unloaded_post.tags.unshift('minustwo', 'minusone')
436
436
  unloaded_post.save
437
- subject[:tags].should == %w(minustwo minusone one two)
437
+ expect(subject[:tags]).to eq(%w(minustwo minusone one two))
438
438
  end
439
439
 
440
440
  it 'should apply unshift after the fact' do