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
@@ -31,7 +31,7 @@ describe Cequel::Record::Schema do
31
31
  its(:data_columns) { should include(Cequel::Schema::List.new(:categories, :text)) }
32
32
  its(:data_columns) { should include(Cequel::Schema::Set.new(:tags, :text)) }
33
33
  its(:data_columns) { should include(Cequel::Schema::Map.new(:trackbacks, :timestamp, :text)) }
34
- specify { subject.property(:comment).should == 'Blog Posts' }
34
+ specify { expect(subject.property(:comment)).to eq('Blog Posts') }
35
35
  end
36
36
 
37
37
  context 'existing model with additional attribute' do
@@ -69,7 +69,7 @@ describe Cequel::Record::Schema do
69
69
  subject { cequel.schema.read_table(table_name) }
70
70
 
71
71
  it 'should order clustering column descending' do
72
- subject.clustering_columns.first.clustering_order.should == :desc
72
+ expect(subject.clustering_columns.first.clustering_order).to eq(:desc)
73
73
  end
74
74
  end
75
75
 
@@ -97,7 +97,7 @@ describe Cequel::Record::Schema do
97
97
 
98
98
  its(:partition_key_columns) { should == [Cequel::Schema::Column.new(:blog_subdomain, :text)] }
99
99
  its(:clustering_columns) { should == [Cequel::Schema::Column.new(:id, :uuid)] }
100
- it { should be_compact_storage }
100
+ it { is_expected.to be_compact_storage }
101
101
  its(:data_columns) { should == [Cequel::Schema::Column.new(:data, :text)] }
102
102
  end
103
103
 
@@ -110,10 +110,10 @@ describe Cequel::Record::Schema do
110
110
  legacy_model.synchronize_schema
111
111
  end
112
112
 
113
- its(:partition_key_columns) { should == [Cequel::Schema::Column.new(:blog_subdomain, :text)] }
114
- its(:clustering_columns) { should == [Cequel::Schema::Column.new(:id, :uuid)] }
115
- it { should be_compact_storage }
116
- its(:data_columns) { should == [Cequel::Schema::Column.new(:data, :text)] }
113
+ its(:partition_key_columns) { is_expected.to eq([Cequel::Schema::Column.new(:blog_subdomain, :text)]) }
114
+ its(:clustering_columns) { is_expected.to eq([Cequel::Schema::Column.new(:id, :uuid)]) }
115
+ it { is_expected.to be_compact_storage }
116
+ its(:data_columns) { is_expected.to eq([Cequel::Schema::Column.new(:data, :text)]) }
117
117
 
118
118
  it 'should be able to synchronize schema again' do
119
119
  expect { legacy_model.synchronize_schema }.to_not raise_error
@@ -9,13 +9,13 @@ describe Cequel::Record::Scoped do
9
9
  end
10
10
 
11
11
  it 'should use current scoped key values to populate new record' do
12
- Post['bigdata'].new.blog_subdomain.should == 'bigdata'
12
+ expect(Post['bigdata'].new.blog_subdomain).to eq('bigdata')
13
13
  end
14
14
 
15
15
  it "should not mess up class' #puts" do
16
16
  StringIO.new.tap do |out|
17
17
  out.puts Post
18
- out.string.should == "Post\n"
18
+ expect(out.string).to eq("Post\n")
19
19
  end
20
20
 
21
21
  end
@@ -21,7 +21,7 @@ describe 'serialization' do
21
21
 
22
22
  it 'should provide JSON serialization' do
23
23
  Post.include_root_in_json = false
24
- Post.new(attributes).as_json.symbolize_keys.
25
- should == attributes.merge(body: nil)
24
+ expect(Post.new(attributes).as_json.symbolize_keys).
25
+ to eq(attributes.merge(body: nil))
26
26
  end
27
27
  end
@@ -24,7 +24,7 @@ describe Cequel::Record::Set do
24
24
 
25
25
  context 'new record' do
26
26
  it 'should save set as-is' do
27
- subject[:tags].should == Set['one', 'two']
27
+ expect(subject[:tags]).to eq(Set['one', 'two'])
28
28
  end
29
29
  end
30
30
 
@@ -32,13 +32,13 @@ describe Cequel::Record::Set do
32
32
  it 'should overwrite value' do
33
33
  post.tags = Set['three', 'four']
34
34
  post.save!
35
- subject[:tags].should == Set['three', 'four']
35
+ expect(subject[:tags]).to eq(Set['three', 'four'])
36
36
  end
37
37
 
38
38
  it 'should cast collection before overwriting' do
39
39
  post.tags = %w(three four)
40
40
  post.save!
41
- subject[:tags].should == Set['three', 'four']
41
+ expect(subject[:tags]).to eq(Set['three', 'four'])
42
42
  end
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ describe Cequel::Record::Set do
49
49
  it 'should add atomically' do
50
50
  post.tags.add('four')
51
51
  post.save
52
- subject[:tags].should == Set['one', 'two', 'three', 'four']
52
+ expect(subject[:tags]).to eq(Set['one', 'two', 'three', 'four'])
53
53
  expect(post.tags).to eq(Set['one', 'two', 'four'])
54
54
  end
55
55
 
@@ -59,10 +59,11 @@ describe Cequel::Record::Set do
59
59
  end
60
60
 
61
61
  it 'should add without reading' do
62
- max_statements! 2
63
- unloaded_post.tags.add('four')
64
- unloaded_post.save
65
- subject[:tags].should == Set['one', 'two', 'three', 'four']
62
+ expect_statement_count 1 do
63
+ unloaded_post.tags.add('four')
64
+ unloaded_post.save
65
+ end
66
+ expect(subject[:tags]).to eq(Set['one', 'two', 'three', 'four'])
66
67
  end
67
68
 
68
69
  it 'should apply add post-hoc' do
@@ -75,15 +76,16 @@ describe Cequel::Record::Set do
75
76
  it 'should clear atomically' do
76
77
  post.tags.clear
77
78
  post.save
78
- subject[:tags].should be_blank
79
+ expect(subject[:tags]).to be_blank
79
80
  expect(post.tags).to eq(Set[])
80
81
  end
81
82
 
82
83
  it 'should clear without reading' do
83
- max_statements! 2
84
- unloaded_post.tags.clear
85
- unloaded_post.save
86
- subject[:tags].should be_blank
84
+ expect_statement_count 1 do
85
+ unloaded_post.tags.clear
86
+ unloaded_post.save
87
+ end
88
+ expect(subject[:tags]).to be_blank
87
89
  end
88
90
 
89
91
  it 'should apply clear post-hoc' do
@@ -96,7 +98,7 @@ describe Cequel::Record::Set do
96
98
  it 'should delete atomically' do
97
99
  post.tags.delete('two')
98
100
  post.save
99
- subject[:tags].should == Set['one', 'three']
101
+ expect(subject[:tags]).to eq(Set['one', 'three'])
100
102
  expect(post.tags).to eq(Set['one'])
101
103
  end
102
104
 
@@ -106,10 +108,11 @@ describe Cequel::Record::Set do
106
108
  end
107
109
 
108
110
  it 'should delete without reading' do
109
- max_statements! 2
110
- unloaded_post.tags.delete('two')
111
- unloaded_post.save
112
- subject[:tags].should == Set['one', 'three']
111
+ expect_statement_count 1 do
112
+ unloaded_post.tags.delete('two')
113
+ unloaded_post.save
114
+ end
115
+ expect(subject[:tags]).to eq(Set['one', 'three'])
113
116
  end
114
117
 
115
118
  it 'should apply delete post-hoc' do
@@ -122,7 +125,7 @@ describe Cequel::Record::Set do
122
125
  it 'should replace atomically' do
123
126
  post.tags.replace(Set['a', 'b'])
124
127
  post.save
125
- subject[:tags].should == Set['a', 'b']
128
+ expect(subject[:tags]).to eq(Set['a', 'b'])
126
129
  expect(post.tags).to eq(Set['a', 'b'])
127
130
  end
128
131
 
@@ -132,10 +135,11 @@ describe Cequel::Record::Set do
132
135
  end
133
136
 
134
137
  it 'should replace without reading' do
135
- max_statements! 2
136
- unloaded_post.tags.replace(Set['a', 'b'])
137
- unloaded_post.save
138
- subject[:tags].should == Set['a', 'b']
138
+ expect_statement_count 1 do
139
+ unloaded_post.tags.replace(Set['a', 'b'])
140
+ unloaded_post.save
141
+ end
142
+ expect(subject[:tags]).to eq(Set['a', 'b'])
139
143
  end
140
144
 
141
145
  it 'should apply delete post-hoc' do
@@ -29,37 +29,37 @@ describe Cequel::Record::Validations do
29
29
 
30
30
  describe '#valid?' do
31
31
  it 'should be false if model is not valid' do
32
- invalid_post.should_not be_valid
32
+ expect(invalid_post).not_to be_valid
33
33
  end
34
34
 
35
35
  it 'should be true if model is valid' do
36
- valid_post.should be_valid
36
+ expect(valid_post).to be_valid
37
37
  end
38
38
  end
39
39
 
40
40
  describe '#invalid?' do
41
41
  it 'should be true if model is not valid' do
42
- invalid_post.should be_invalid
42
+ expect(invalid_post).to be_invalid
43
43
  end
44
44
 
45
45
  it 'should be false if model is valid' do
46
- valid_post.should_not be_invalid
46
+ expect(valid_post).not_to be_invalid
47
47
  end
48
48
  end
49
49
 
50
50
  describe '#save' do
51
51
  it 'should return false and not persist model if invalid' do
52
- invalid_post.save.should be_false
52
+ expect(invalid_post.save).to eq(false)
53
53
  end
54
54
 
55
55
  it 'should return true and persist model if valid' do
56
- valid_post.save.should be_true
57
- Post.find('valid').title.should == 'Valid Post'
56
+ expect(valid_post.save).to eq(true)
57
+ expect(Post.find('valid').title).to eq('Valid Post')
58
58
  end
59
59
 
60
60
  it 'should bypass validations if :validate => false is passed' do
61
- invalid_post.save(:validate => false).should be_true
62
- Post.find('invalid').body.should == 'This is an invalid post.'
61
+ expect(invalid_post.save(:validate => false)).to eq(true)
62
+ expect(Post.find('invalid').body).to eq('This is an invalid post.')
63
63
  end
64
64
  end
65
65
 
@@ -71,7 +71,7 @@ describe Cequel::Record::Validations do
71
71
 
72
72
  it 'should persist model and return self if valid' do
73
73
  expect { valid_post.save! }.to_not raise_error
74
- Post.find(valid_post.permalink).title.should == 'Valid Post'
74
+ expect(Post.find(valid_post.permalink).title).to eq('Valid Post')
75
75
  end
76
76
  end
77
77
 
@@ -83,7 +83,7 @@ describe Cequel::Record::Validations do
83
83
 
84
84
  it 'should return successfully and update data in the database if valid' do
85
85
  invalid_post.update_attributes!(:title => 'My Post')
86
- Post.find(invalid_post.permalink).title.should == 'My Post'
86
+ expect(Post.find(invalid_post.permalink).title).to eq('My Post')
87
87
  end
88
88
  end
89
89
 
@@ -96,7 +96,7 @@ describe Cequel::Record::Validations do
96
96
 
97
97
  it 'should persist record to database if valid' do
98
98
  Post.create!(:permalink => 'cequel', :title => 'Cequel')
99
- Post.find('cequel').title.should == 'Cequel'
99
+ expect(Post.find('cequel').title).to eq('Cequel')
100
100
  end
101
101
  end
102
102
 
@@ -104,7 +104,7 @@ describe Cequel::Record::Validations do
104
104
  it 'should call validation callbacks' do
105
105
  post = Post.new(:title => 'cequel')
106
106
  post.valid?
107
- post.called_validate_callback.should be_true
107
+ expect(post.called_validate_callback).to eq(true)
108
108
  end
109
109
  end
110
110
  end
@@ -15,15 +15,15 @@ describe Cequel::Schema::TableReader do
15
15
  end
16
16
 
17
17
  it 'should read name correctly' do
18
- table.partition_key_columns.first.name.should == :permalink
18
+ expect(table.partition_key_columns.first.name).to eq(:permalink)
19
19
  end
20
20
 
21
21
  it 'should read type correctly' do
22
- table.partition_key_columns.first.type.should be_a(Cequel::Type::Text)
22
+ expect(table.partition_key_columns.first.type).to be_a(Cequel::Type::Text)
23
23
  end
24
24
 
25
25
  it 'should have no nonpartition keys' do
26
- table.clustering_columns.should be_empty
26
+ expect(table.clustering_columns).to be_empty
27
27
  end
28
28
  end # describe 'reading simple key'
29
29
 
@@ -39,24 +39,24 @@ describe Cequel::Schema::TableReader do
39
39
  end
40
40
 
41
41
  it 'should read partition key name' do
42
- table.partition_key_columns.map(&:name).should == [:blog_subdomain]
42
+ expect(table.partition_key_columns.map(&:name)).to eq([:blog_subdomain])
43
43
  end
44
44
 
45
45
  it 'should read partition key type' do
46
- table.partition_key_columns.map(&:type).should == [Cequel::Type::Text.instance]
46
+ expect(table.partition_key_columns.map(&:type)).to eq([Cequel::Type::Text.instance])
47
47
  end
48
48
 
49
49
  it 'should read non-partition key name' do
50
- table.clustering_columns.map(&:name).should == [:permalink]
50
+ expect(table.clustering_columns.map(&:name)).to eq([:permalink])
51
51
  end
52
52
 
53
53
  it 'should read non-partition key type' do
54
- table.clustering_columns.map(&:type).
55
- should == [Cequel::Type::Ascii.instance]
54
+ expect(table.clustering_columns.map(&:type)).
55
+ to eq([Cequel::Type::Ascii.instance])
56
56
  end
57
57
 
58
58
  it 'should default clustering order to asc' do
59
- table.clustering_columns.map(&:clustering_order).should == [:asc]
59
+ expect(table.clustering_columns.map(&:clustering_order)).to eq([:asc])
60
60
  end
61
61
  end # describe 'reading single non-partition key'
62
62
 
@@ -73,16 +73,16 @@ describe Cequel::Schema::TableReader do
73
73
  end
74
74
 
75
75
  it 'should read non-partition key name' do
76
- table.clustering_columns.map(&:name).should == [:permalink]
76
+ expect(table.clustering_columns.map(&:name)).to eq([:permalink])
77
77
  end
78
78
 
79
79
  it 'should read non-partition key type' do
80
- table.clustering_columns.map(&:type).
81
- should == [Cequel::Type::Ascii.instance]
80
+ expect(table.clustering_columns.map(&:type)).
81
+ to eq([Cequel::Type::Ascii.instance])
82
82
  end
83
83
 
84
84
  it 'should recognize reversed clustering order' do
85
- table.clustering_columns.map(&:clustering_order).should == [:desc]
85
+ expect(table.clustering_columns.map(&:clustering_order)).to eq([:desc])
86
86
  end
87
87
  end # describe 'reading reverse-ordered non-partition key'
88
88
 
@@ -100,16 +100,16 @@ describe Cequel::Schema::TableReader do
100
100
  end
101
101
 
102
102
  it 'should read non-partition key names' do
103
- table.clustering_columns.map(&:name).should == [:permalink, :author_id]
103
+ expect(table.clustering_columns.map(&:name)).to eq([:permalink, :author_id])
104
104
  end
105
105
 
106
106
  it 'should read non-partition key types' do
107
- table.clustering_columns.map(&:type).
108
- should == [Cequel::Type::Ascii.instance, Cequel::Type::Uuid.instance]
107
+ expect(table.clustering_columns.map(&:type)).
108
+ to eq([Cequel::Type::Ascii.instance, Cequel::Type::Uuid.instance])
109
109
  end
110
110
 
111
111
  it 'should read heterogeneous clustering orders' do
112
- table.clustering_columns.map(&:clustering_order).should == [:desc, :asc]
112
+ expect(table.clustering_columns.map(&:clustering_order)).to eq([:desc, :asc])
113
113
  end
114
114
  end # describe 'reading compound non-partition key'
115
115
 
@@ -125,16 +125,16 @@ describe Cequel::Schema::TableReader do
125
125
  end
126
126
 
127
127
  it 'should read partition key names' do
128
- table.partition_key_columns.map(&:name).should == [:blog_subdomain, :permalink]
128
+ expect(table.partition_key_columns.map(&:name)).to eq([:blog_subdomain, :permalink])
129
129
  end
130
130
 
131
131
  it 'should read partition key types' do
132
- table.partition_key_columns.map(&:type).
133
- should == [Cequel::Type::Text.instance, Cequel::Type::Ascii.instance]
132
+ expect(table.partition_key_columns.map(&:type)).
133
+ to eq([Cequel::Type::Text.instance, Cequel::Type::Ascii.instance])
134
134
  end
135
135
 
136
136
  it 'should have empty nonpartition keys' do
137
- table.clustering_columns.should be_empty
137
+ expect(table.clustering_columns).to be_empty
138
138
  end
139
139
 
140
140
  end # describe 'reading compound partition key'
@@ -154,26 +154,27 @@ describe Cequel::Schema::TableReader do
154
154
  end
155
155
 
156
156
  it 'should read partition key names' do
157
- table.partition_key_columns.map(&:name).should == [:blog_subdomain, :permalink]
157
+ expect(table.partition_key_columns.map(&:name)).to eq([:blog_subdomain, :permalink])
158
158
  end
159
159
 
160
160
  it 'should read partition key types' do
161
- table.partition_key_columns.map(&:type).
162
- should == [Cequel::Type::Text.instance, Cequel::Type::Ascii.instance]
161
+ expect(table.partition_key_columns.map(&:type)).
162
+ to eq([Cequel::Type::Text.instance, Cequel::Type::Ascii.instance])
163
163
  end
164
164
 
165
165
  it 'should read non-partition key names' do
166
- table.clustering_columns.map(&:name).
167
- should == [:author_id, :published_at]
166
+ expect(table.clustering_columns.map(&:name)).
167
+ to eq([:author_id, :published_at])
168
168
  end
169
169
 
170
170
  it 'should read non-partition key types' do
171
- table.clustering_columns.map(&:type).should ==
171
+ expect(table.clustering_columns.map(&:type)).to eq(
172
172
  [Cequel::Type::Uuid.instance, Cequel::Type::Timestamp.instance]
173
+ )
173
174
  end
174
175
 
175
176
  it 'should read clustering order' do
176
- table.clustering_columns.map(&:clustering_order).should == [:asc, :desc]
177
+ expect(table.clustering_columns.map(&:clustering_order)).to eq([:asc, :desc])
177
178
  end
178
179
 
179
180
  end # describe 'reading compound partition and non-partition keys'
@@ -197,55 +198,55 @@ describe Cequel::Schema::TableReader do
197
198
  end
198
199
 
199
200
  it 'should read types of scalar data columns' do
200
- table.data_columns.find { |column| column.name == :title }.type.
201
- should == Cequel::Type[:text]
202
- table.data_columns.find { |column| column.name == :author_id }.type.
203
- should == Cequel::Type[:uuid]
201
+ expect(table.data_columns.find { |column| column.name == :title }.type).
202
+ to eq(Cequel::Type[:text])
203
+ expect(table.data_columns.find { |column| column.name == :author_id }.type).
204
+ to eq(Cequel::Type[:uuid])
204
205
  end
205
206
 
206
207
  it 'should read index attributes' do
207
- table.data_columns.find { |column| column.name == :author_id }.index_name.
208
- should == :posts_author_id_idx
208
+ expect(table.data_columns.find { |column| column.name == :author_id }.index_name).
209
+ to eq(:posts_author_id_idx)
209
210
  end
210
211
 
211
212
  it 'should leave nil index for non-indexed columns' do
212
- table.data_columns.find { |column| column.name == :title }.index_name.
213
- should be_nil
213
+ expect(table.data_columns.find { |column| column.name == :title }.index_name).
214
+ to be_nil
214
215
  end
215
216
 
216
217
  it 'should read list columns' do
217
- table.data_columns.find { |column| column.name == :categories }.
218
- should be_a(Cequel::Schema::List)
218
+ expect(table.data_columns.find { |column| column.name == :categories }).
219
+ to be_a(Cequel::Schema::List)
219
220
  end
220
221
 
221
222
  it 'should read list column type' do
222
- table.data_columns.find { |column| column.name == :categories }.type.
223
- should == Cequel::Type[:text]
223
+ expect(table.data_columns.find { |column| column.name == :categories }.type).
224
+ to eq(Cequel::Type[:text])
224
225
  end
225
226
 
226
227
  it 'should read set columns' do
227
- table.data_columns.find { |column| column.name == :tags }.
228
- should be_a(Cequel::Schema::Set)
228
+ expect(table.data_columns.find { |column| column.name == :tags }).
229
+ to be_a(Cequel::Schema::Set)
229
230
  end
230
231
 
231
232
  it 'should read set column type' do
232
- table.data_columns.find { |column| column.name == :tags }.type.
233
- should == Cequel::Type[:text]
233
+ expect(table.data_columns.find { |column| column.name == :tags }.type).
234
+ to eq(Cequel::Type[:text])
234
235
  end
235
236
 
236
237
  it 'should read map columns' do
237
- table.data_columns.find { |column| column.name == :trackbacks }.
238
- should be_a(Cequel::Schema::Map)
238
+ expect(table.data_columns.find { |column| column.name == :trackbacks }).
239
+ to be_a(Cequel::Schema::Map)
239
240
  end
240
241
 
241
242
  it 'should read map column key type' do
242
- table.data_columns.find { |column| column.name == :trackbacks }.key_type.
243
- should == Cequel::Type[:timestamp]
243
+ expect(table.data_columns.find { |column| column.name == :trackbacks }.key_type).
244
+ to eq(Cequel::Type[:timestamp])
244
245
  end
245
246
 
246
247
  it 'should read map column value type' do
247
- table.data_columns.find { |column| column.name == :trackbacks }.
248
- value_type.should == Cequel::Type[:ascii]
248
+ expect(table.data_columns.find { |column| column.name == :trackbacks }.
249
+ value_type).to eq(Cequel::Type[:ascii])
249
250
  end
250
251
 
251
252
  end # describe 'reading data columns'
@@ -272,41 +273,41 @@ describe Cequel::Schema::TableReader do
272
273
  end
273
274
 
274
275
  it 'should read float properties' do
275
- table.property(:bloom_filter_fp_chance).should == 0.02
276
+ expect(table.property(:bloom_filter_fp_chance)).to eq(0.02)
276
277
  end
277
278
 
278
279
  it 'should read string properties' do
279
- table.property(:comment).should == 'Posts table'
280
+ expect(table.property(:comment)).to eq('Posts table')
280
281
  end
281
282
 
282
283
  it 'should read and simplify compaction class' do
283
- table.property(:compaction)[:class].
284
- should == 'SizeTieredCompactionStrategy'
284
+ expect(table.property(:compaction)[:class]).
285
+ to eq('SizeTieredCompactionStrategy')
285
286
  end
286
287
 
287
288
  it 'should read float properties from compaction hash' do
288
- table.property(:compaction)[:bucket_high].should == 1.8
289
+ expect(table.property(:compaction)[:bucket_high]).to eq(1.8)
289
290
  end
290
291
 
291
292
  it 'should read integer properties from compaction hash' do
292
- table.property(:compaction)[:max_threshold].should == 64
293
+ expect(table.property(:compaction)[:max_threshold]).to eq(64)
293
294
  end
294
295
 
295
296
  it 'should read and simplify compression class' do
296
- table.property(:compression)[:sstable_compression].
297
- should == 'DeflateCompressor'
297
+ expect(table.property(:compression)[:sstable_compression]).
298
+ to eq('DeflateCompressor')
298
299
  end
299
300
 
300
301
  it 'should read integer properties from compression class' do
301
- table.property(:compression)[:chunk_length_kb].should == 128
302
+ expect(table.property(:compression)[:chunk_length_kb]).to eq(128)
302
303
  end
303
304
 
304
305
  it 'should read float properties from compression class' do
305
- table.property(:compression)[:crc_check_chance].should == 0.5
306
+ expect(table.property(:compression)[:crc_check_chance]).to eq(0.5)
306
307
  end
307
308
 
308
309
  it 'should recognize no compact storage' do
309
- table.should_not be_compact_storage
310
+ expect(table).not_to be_compact_storage
310
311
  end
311
312
 
312
313
  end # describe 'reading storage properties'
@@ -320,13 +321,13 @@ describe Cequel::Schema::TableReader do
320
321
  end
321
322
  subject { table }
322
323
 
323
- it { should be_compact_storage }
324
+ it { is_expected.to be_compact_storage }
324
325
  its(:partition_key_columns) { should ==
325
326
  [Cequel::Schema::PartitionKey.new(:permalink, :text)] }
326
327
  its(:clustering_columns) { should be_empty }
327
- its(:data_columns) { should =~
328
- [Cequel::Schema::DataColumn.new(:title, :text),
329
- Cequel::Schema::DataColumn.new(:body, :text)] }
328
+ specify { expect(table.data_columns).to contain_exactly(
329
+ Cequel::Schema::DataColumn.new(:title, :text),
330
+ Cequel::Schema::DataColumn.new(:body, :text)) }
330
331
  end
331
332
 
332
333
  describe 'wide-row compact storage' do
@@ -343,7 +344,7 @@ describe Cequel::Schema::TableReader do
343
344
  end
344
345
  subject { table }
345
346
 
346
- it { should be_compact_storage }
347
+ it { is_expected.to be_compact_storage }
347
348
  its(:partition_key_columns) { should ==
348
349
  [Cequel::Schema::PartitionKey.new(:blog_subdomain, :text)] }
349
350
  its(:clustering_columns) { should ==
@@ -360,13 +361,15 @@ describe Cequel::Schema::TableReader do
360
361
  end
361
362
  subject { table }
362
363
 
363
- it { should be_compact_storage }
364
- its(:partition_key_columns) { should ==
365
- [Cequel::Schema::PartitionKey.new(:permalink, :text)] }
366
- its(:clustering_columns) { should be_empty }
367
- its(:data_columns) { should =~
364
+ it { is_expected.to be_compact_storage }
365
+ its(:partition_key_columns) { is_expected.to eq(
366
+ [Cequel::Schema::PartitionKey.new(:permalink, :text)]
367
+ ) }
368
+ its(:clustering_columns) { is_expected.to be_empty }
369
+ its(:data_columns) { is_expected.to match_array(
368
370
  [Cequel::Schema::DataColumn.new(:title, :text),
369
- Cequel::Schema::DataColumn.new(:body, :text)] }
371
+ Cequel::Schema::DataColumn.new(:body, :text)]
372
+ ) }
370
373
  end
371
374
 
372
375
  describe 'wide-row legacy table', thrift: true do
@@ -378,12 +381,15 @@ describe Cequel::Schema::TableReader do
378
381
  end
379
382
  subject { table }
380
383
 
381
- it { should be_compact_storage }
382
- its(:partition_key_columns) { should ==
383
- [Cequel::Schema::PartitionKey.new(:blog_subdomain, :text)] }
384
- its(:clustering_columns) { should ==
385
- [Cequel::Schema::ClusteringColumn.new(:column1, :uuid)] }
386
- its(:data_columns) { should ==
387
- [Cequel::Schema::DataColumn.new(:value, :text)] }
384
+ it { is_expected.to be_compact_storage }
385
+ its(:partition_key_columns) { is_expected.to eq(
386
+ [Cequel::Schema::PartitionKey.new(:blog_subdomain, :text)]
387
+ ) }
388
+ its(:clustering_columns) { is_expected.to eq(
389
+ [Cequel::Schema::ClusteringColumn.new(:column1, :uuid)]
390
+ ) }
391
+ its(:data_columns) { is_expected.to eq(
392
+ [Cequel::Schema::DataColumn.new(:value, :text)]
393
+ ) }
388
394
  end
389
395
  end