cequel 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02ce6a58ba37d6d660bab77d19bbb1a5058f2272
4
- data.tar.gz: 5c48b614b57a353caff4330013398549ed7dde7c
3
+ metadata.gz: d14904f7678b99fb9228f1d0e255ece706ac607f
4
+ data.tar.gz: 9f63a0b4abf6d672c9712d7e5eebe34aae777212
5
5
  SHA512:
6
- metadata.gz: 4eca1a7b499d4e75ce7cdd26af7fcc62b5cda4505e7c260abe1ca8518054f2f7d5a06ce79e43d75c3106b9ddcaa898d3d6c0824a3ab67a70d639a4d574725bd2
7
- data.tar.gz: 14727e13ee05fca86ec0cd4297a8d7ef6601722cdea5b6601a5dc34fe52c9da17a63e7c18253a255d6618e7ee2d01f9a49be5c1d37125b96eae3f4bb057bde30
6
+ metadata.gz: bbad8d78bc4b5752cd0a708948c6f95fa0145679a3d8748ca16084e15b11b6c820817a244083d357799fc05c44c188dfe5703b22527ab1c3de5e36522418eb5c
7
+ data.tar.gz: c0eaaa9c567b14710dbd73bf58c6fe8ff27bec66b99545a362017206839c5f88c4de146500b50c97fc3c776041534fb1517107bed4e43d69472b7fb3d1ba82ac
@@ -1,3 +1,13 @@
1
+ ## 1.7.0
2
+
3
+ * Support Cassandra up to 2.2
4
+ * Support JRuby 9
5
+ * Drop support for Rails 3, Ruby 1.9
6
+ * Update to `cassandra-driver` 2.0
7
+ * Support SSL configuration
8
+ * Add `RecordSet#first_or_initialize` and `RecordSet#first!`
9
+ * Rake task to reset keyspace
10
+
1
11
  ## 1.6.1
2
12
 
3
13
  * Ruby 1.9 no longer supported (EOL)
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cequel (1.6.1)
5
- activemodel (>= 3.1, < 5.0)
6
- cassandra-driver (~> 1.0)
4
+ cequel (1.7.0)
5
+ activemodel (~> 4.0)
6
+ cassandra-driver (~> 2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.2.1)
12
- activesupport (= 4.2.1)
11
+ activemodel (4.2.4)
12
+ activesupport (= 4.2.4)
13
13
  builder (~> 3.1)
14
- activesupport (4.2.1)
14
+ activesupport (4.2.4)
15
15
  i18n (~> 0.7)
16
16
  json (~> 1.7, >= 1.7.7)
17
17
  minitest (~> 5.1)
@@ -30,9 +30,7 @@ GEM
30
30
  byebug (2.7.0)
31
31
  columnize (~> 0.3)
32
32
  debugger-linecache (~> 1.2)
33
- cassandra-driver (1.2.0)
34
- ione (~> 1.2)
35
- cassandra-driver (1.2.0-java)
33
+ cassandra-driver (2.1.4)
36
34
  ione (~> 1.2)
37
35
  coderay (1.1.0)
38
36
  columnize (0.9.0)
@@ -61,7 +59,7 @@ GEM
61
59
  net-http-pipeline
62
60
  highline (1.6.21)
63
61
  i18n (0.7.0)
64
- ione (1.2.0)
62
+ ione (1.2.1)
65
63
  json (1.8.2)
66
64
  json (1.8.2-java)
67
65
  launchy (2.4.3)
@@ -70,7 +68,7 @@ GEM
70
68
  addressable (~> 2.3)
71
69
  spoon (~> 0.0.1)
72
70
  method_source (0.8.2)
73
- minitest (5.6.0)
71
+ minitest (5.8.0)
74
72
  multi_json (1.10.1)
75
73
  multipart-post (2.0.0)
76
74
  net-http-persistent (2.9.4)
@@ -321,7 +319,6 @@ GEM
321
319
  ffi
322
320
  thor (0.19.1)
323
321
  thread_safe (0.3.5)
324
- thread_safe (0.3.5-java)
325
322
  timecop (0.7.1)
326
323
  travis (1.7.5)
327
324
  addressable (~> 2.3)
data/README.md CHANGED
@@ -337,7 +337,7 @@ Post.find_all_by_author_id(id) # returns an array of all posts with that author_
337
337
  You can also call the `where` method directly on record sets:
338
338
 
339
339
  ```ruby
340
- Post.where(:author_id, id)
340
+ Post.where(author_id: id)
341
341
  ```
342
342
 
343
343
  ### Consistency tuning ###
@@ -516,21 +516,19 @@ the columns that are given.
516
516
  * 4.2
517
517
  * 4.1
518
518
  * 4.0
519
- * 3.2
520
519
 
521
520
  ### Ruby ###
522
521
 
523
522
  * Ruby 2.2, 2.1, 2.0
524
- * JRuby 1.7
523
+ * JRuby 1.7, 9.0
525
524
  * Rubinius 2.5
526
525
 
527
526
  ### Cassandra ###
528
527
 
529
- * 1.2
530
- * 2.0
528
+ * 2.x
531
529
 
532
- Though Cequel is tested against Cassandra 2.0, it does not at this time support
533
- any of the CQL3.1 features introduced in Cassandra 2.0. This will change in the
530
+ Though Cequel is tested against Cassandra 2, it does not at this time support
531
+ any of the CQL3.1 features introduced in Cassandra 2. This will change in the
534
532
  future.
535
533
 
536
534
  ## Support & Bugs ##
data/Rakefile CHANGED
@@ -11,7 +11,6 @@ RUBY_VERSIONS = YAML.load_file(File.expand_path('../.travis.yml', __FILE__))['rv
11
11
  task :default => :release
12
12
  task :release => [
13
13
  :verify_changelog,
14
- :rubocop,
15
14
  :"test:all",
16
15
  :build,
17
16
  :tag,
@@ -135,7 +135,7 @@ exec /opt/apache-cassandra-$1/bin/cassandra" > /etc/init/cassandra.conf
135
135
  SH
136
136
 
137
137
  versions = File.read(File.expand_path('../.cassandra-versions', __FILE__)).each_line
138
- .map(&:strip).grep(/^(1\.2\.|2\.)/)
138
+ .map(&:strip).grep(/^2\./)
139
139
  versions.each do |version|
140
140
  java_version = version =~ /^1/ ? '6' : '7'
141
141
  config.vm.define version do |machine|
@@ -26,9 +26,9 @@ DESC
26
26
  s.test_files = Dir['spec/examples/**/*.rb']
27
27
  s.has_rdoc = true
28
28
  s.extra_rdoc_files = 'README.md'
29
- s.required_ruby_version = '>= 1.9'
30
- s.add_runtime_dependency 'activemodel', '>= 3.1', '< 5.0'
31
- s.add_runtime_dependency 'cassandra-driver', '~> 1.0'
29
+ s.required_ruby_version = '>= 2.0'
30
+ s.add_runtime_dependency 'activemodel', '~> 4.0'
31
+ s.add_runtime_dependency 'cassandra-driver', '~> 2.0'
32
32
  s.add_development_dependency 'appraisal', '~> 1.0'
33
33
  s.add_development_dependency 'wwtd', '~> 0.5'
34
34
  s.add_development_dependency 'rake', '~> 10.1'
@@ -38,5 +38,5 @@ DESC
38
38
  s.add_development_dependency 'timecop', '~> 0.7'
39
39
  s.add_development_dependency 'travis', '~> 1.7'
40
40
  s.add_development_dependency 'yard', '~> 0.6'
41
- s.requirements << 'Cassandra >= 1.2.0'
41
+ s.requirements << 'Cassandra >= 2.0.0'
42
42
  end
@@ -30,6 +30,8 @@ module Cequel
30
30
  attr_writer :default_consistency
31
31
  # @return [Hash] credentials for connect to cassandra
32
32
  attr_reader :credentials
33
+ # @return [Hash] SSL Configuration options
34
+ attr_reader :ssl_config
33
35
 
34
36
  #
35
37
  # @!method write(statement, *bind_vars)
@@ -111,6 +113,15 @@ module Cequel
111
113
  # @option configuration [String] :password password to auth with (leave
112
114
  # blank for no auth)
113
115
  # @option configuration [String] :keyspace name of keyspace to connect to
116
+ # @option configuration [Boolean] :ssl enable/disable ssl/tls support
117
+ # @option configuration [String] :server_cert path to ssl server
118
+ # certificate
119
+ # @option configuration [String] :client_cert path to ssl client
120
+ # certificate
121
+ # @option configuration [String] :private_key path to ssl client private
122
+ # key
123
+ # @option configuartion [String] :passphrase the passphrase for client
124
+ # private key
114
125
  # @return [void]
115
126
  #
116
127
  def configure(configuration = {})
@@ -124,6 +135,7 @@ module Cequel
124
135
  @credentials = extract_credentials(configuration)
125
136
  @max_retries = extract_max_retries(configuration)
126
137
  @retry_delay = extract_retry_delay(configuration)
138
+ @ssl_config = extract_ssl_config(configuration)
127
139
 
128
140
  @name = configuration[:keyspace]
129
141
  @default_consistency = configuration[:default_consistency].try(:to_sym)
@@ -216,6 +228,7 @@ module Cequel
216
228
  remove_instance_variable(:@client_without_keyspace)
217
229
  end
218
230
  if defined? @cluster
231
+ @cluster.close
219
232
  remove_instance_variable(:@cluster)
220
233
  end
221
234
  end
@@ -266,6 +279,7 @@ module Cequel
266
279
  def client_options
267
280
  {hosts: hosts, port: port}.tap do |options|
268
281
  options.merge!(credentials) if credentials
282
+ options.merge!(ssl_config) if ssl_config
269
283
  end
270
284
  end
271
285
 
@@ -312,6 +326,17 @@ module Cequel
312
326
  def extract_retry_delay(configuration)
313
327
  configuration.fetch(:retry_delay, 0.5)
314
328
  end
329
+
330
+ def extract_ssl_config(configuration)
331
+ ssl_config = {}
332
+ ssl_config[:ssl] = configuration.fetch(:ssl, nil)
333
+ ssl_config[:server_cert] = configuration.fetch(:server_cert, nil)
334
+ ssl_config[:client_cert] = configuration.fetch(:client_cert, nil)
335
+ ssl_config[:private_key] = configuration.fetch(:private_key, nil)
336
+ ssl_config[:passphrase] = configuration.fetch(:passphrase, nil)
337
+ ssl_config.each { |key, value| ssl_config.delete(key) unless value }
338
+ ssl_config
339
+ end
315
340
  end
316
341
  end
317
342
  end
@@ -478,6 +478,24 @@ module Cequel
478
478
  count ? limit(count).entries : limit(1).each.first
479
479
  end
480
480
 
481
+ #
482
+ # @return [Record] the first record or a new instance
483
+ #
484
+ def first_or_initialize
485
+ first || new
486
+ end
487
+
488
+ #
489
+ # @return [Record] the first record
490
+ # @raise [RecordNotFound] if the record set is empty
491
+ #
492
+ def first!
493
+ first or fail(RecordNotFound,
494
+ "Couldn't find record with keys: #{
495
+ scoped_key_attributes.map { |k, v|
496
+ "#{k}: #{v}" }.join(', ')}")
497
+ end
498
+
481
499
  #
482
500
  # @overload last
483
501
  # @return [Record] the last record in this record set
@@ -6,20 +6,46 @@ namespace :cequel do
6
6
  namespace :keyspace do
7
7
  desc 'Initialize Cassandra keyspace'
8
8
  task :create => :environment do
9
- Cequel::Record.connection.schema.create!
10
- puts "Created keyspace #{Cequel::Record.connection.name}"
9
+ create!
11
10
  end
12
11
 
13
12
  desc 'Drop Cassandra keyspace'
14
13
  task :drop => :environment do
15
- Cequel::Record.connection.schema.drop!
16
- puts "Dropped keyspace #{Cequel::Record.connection.name}"
14
+ drop!
17
15
  end
18
16
  end
19
17
 
20
18
  desc "Synchronize all models defined in `app/models' with Cassandra " \
21
19
  "database schema"
22
20
  task :migrate => :environment do
21
+ migrate
22
+ end
23
+
24
+ desc "Create keyspace and tables for all defined models"
25
+ task :init => %w(keyspace:create migrate)
26
+
27
+
28
+ desc 'Drop keyspace if exists, then create and migrate'
29
+ task :reset => :environment do
30
+ if Cequel::Record.connection.schema.exists?
31
+ drop!
32
+ end
33
+ create!
34
+ migrate
35
+ end
36
+
37
+ def create!
38
+ Cequel::Record.connection.schema.create!
39
+ puts "Created keyspace #{Cequel::Record.connection.name}"
40
+ end
41
+
42
+
43
+ def drop!
44
+ Cequel::Record.connection.schema.drop!
45
+ puts "Dropped keyspace #{Cequel::Record.connection.name}"
46
+ end
47
+
48
+ def migrate
23
49
  watch_stack = ActiveSupport::Dependencies::WatchStack.new
24
50
 
25
51
  migration_table_names = Set[]
@@ -58,7 +84,4 @@ namespace :cequel do
58
84
  end
59
85
  end
60
86
  end
61
-
62
- desc "Create keyspace and tables for all defined models"
63
- task :init => %w(keyspace:create migrate)
64
87
  end
@@ -73,31 +73,35 @@ module Cequel
73
73
  # for now. It will be worth refactoring this code to take advantage of
74
74
  # 2.0's better interface in a future version of Cequel that targets 2.0+.
75
75
  def read_partition_keys
76
- validator = table_data['key_validator']
77
- types = parse_composite_types(validator) || [validator]
78
- JSON.parse(table_data['key_aliases']).zip(types) do |key_alias, type|
79
- name = key_alias.to_sym
80
- table.add_partition_key(key_alias.to_sym, Type.lookup_internal(type))
76
+ validators = table_data['key_validator']
77
+ types = parse_composite_types(validators) || [validators]
78
+ columns = partition_columns.sort { |c| c['component_index'] }
79
+ .map { |c| c['column_name'] }
80
+
81
+ columns.zip(types) do |name, type|
82
+ table.add_partition_key(name.to_sym, Type.lookup_internal(type))
81
83
  end
82
84
  end
83
85
 
84
86
  # XXX See comment on {read_partition_keys}
85
87
  def read_clustering_columns
86
- column_aliases = JSON.parse(table_data['column_aliases'])
88
+ columns = cluster_columns.sort { |l, r| l['component_index'] <=> r['component_index'] }
89
+ .map { |c| c['column_name'] }
87
90
  comparators = parse_composite_types(table_data['comparator'])
88
91
  unless comparators
89
92
  table.compact_storage = true
90
93
  return unless column_data.empty?
91
- column_aliases << :column1 if column_aliases.empty?
94
+ columns << :column1 if cluster_columns.empty?
92
95
  comparators = [table_data['comparator']]
93
96
  end
94
- column_aliases.zip(comparators) do |column_alias, type|
97
+
98
+ columns.zip(comparators) do |name, type|
95
99
  if REVERSED_TYPE_PATTERN =~ type
96
100
  type = $1
97
101
  clustering_order = :desc
98
102
  end
99
103
  table.add_clustering_column(
100
- column_alias.to_sym,
104
+ name.to_sym,
101
105
  Type.lookup_internal(type),
102
106
  clustering_order
103
107
  )
@@ -107,7 +111,7 @@ module Cequel
107
111
  def read_data_columns
108
112
  if column_data.empty?
109
113
  table.add_data_column(
110
- (table_data['value_alias'] || :value).to_sym,
114
+ (compact_value['column_name'] || :value).to_sym,
111
115
  Type.lookup_internal(table_data['default_validator']),
112
116
  false
113
117
  )
@@ -163,18 +167,40 @@ module Cequel
163
167
  @table_data = table_query.first.try(:to_hash)
164
168
  end
165
169
 
166
- def column_data
167
- @column_data ||=
170
+ def all_columns
171
+ @all_columns ||=
168
172
  if table_data
169
173
  column_query = keyspace.execute(<<-CQL, keyspace.name, table_name)
170
174
  SELECT * FROM system.schema_columns
171
175
  WHERE keyspace_name = ? AND columnfamily_name = ?
172
176
  CQL
173
- column_query.map(&:to_hash).select do |column|
174
- !column.key?('type') || column['type'] == 'regular'
175
- end
177
+ column_query.map(&:to_hash)
176
178
  end
177
179
  end
180
+
181
+ def compact_value
182
+ @compact_value ||= all_columns.find do |column|
183
+ column['type'] == 'compact_value'
184
+ end || {}
185
+ end
186
+
187
+ def column_data
188
+ @column_data ||= all_columns.select do |column|
189
+ !column.key?('type') || column['type'] == 'regular'
190
+ end
191
+ end
192
+
193
+ def partition_columns
194
+ @partition_columns ||= all_columns.select do |column|
195
+ column['type'] == 'partition_key'
196
+ end
197
+ end
198
+
199
+ def cluster_columns
200
+ @cluster_columns ||= all_columns.select do |column|
201
+ column['type'] == 'clustering_key'
202
+ end
203
+ end
178
204
  end
179
205
  end
180
206
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Cequel
3
3
  # The current version of the library
4
- VERSION = '1.6.1'
4
+ VERSION = '1.7.0'
5
5
  end
@@ -506,7 +506,7 @@ describe Cequel::Metal::DataSet do
506
506
  expect(cequel[:posts].where(
507
507
  :blog_subdomain => %w(cassandra big-data-weekly),
508
508
  :permalink => 'big-data'
509
- ).map { |row| row[:title] }).to eq(['Big Data', 'Cassandra'])
509
+ ).map { |row| row[:title] }).to match_array(['Big Data', 'Cassandra'])
510
510
  end
511
511
 
512
512
  it 'should use = if provided one-element array' do
@@ -86,6 +86,24 @@ describe Cequel::Metal::Keyspace do
86
86
  end
87
87
  end
88
88
 
89
+ describe "#ssl_config" do
90
+ it "ssl configuration settings get extracted correctly for sending to cluster" do
91
+ connect = Cequel.connect host: Cequel::SpecSupport::Helpers.host,
92
+ port: Cequel::SpecSupport::Helpers.port,
93
+ ssl: true,
94
+ server_cert: 'path/to/server_cert',
95
+ client_cert: 'path/to/client_cert',
96
+ private_key: 'private_key',
97
+ passphrase: 'passphrase'
98
+
99
+ expect(connect.ssl_config[:ssl]).to be true
100
+ expect(connect.ssl_config[:server_cert]).to eq('path/to/server_cert')
101
+ expect(connect.ssl_config[:client_cert]).to eq('path/to/client_cert')
102
+ expect(connect.ssl_config[:private_key]).to eq('private_key')
103
+ expect(connect.ssl_config[:passphrase]).to eq('passphrase')
104
+ end
105
+ end
106
+
89
107
  describe "#execute" do
90
108
  let(:statement) { "SELECT id FROM posts" }
91
109
 
@@ -628,6 +628,48 @@ describe Cequel::Record::RecordSet do
628
628
  end
629
629
  end
630
630
 
631
+ describe '#first_or_initialize' do
632
+ context 'when there are posts' do
633
+ let(:post) { posts.first }
634
+
635
+ before { post }
636
+
637
+ it 'returns the first post' do
638
+ expect_any_instance_of(described_class).to receive(:first).and_return(post)
639
+ expect(Post.first_or_initialize).to eq post
640
+ end
641
+ end
642
+
643
+ context 'when there are no posts' do
644
+ it 'returns a new post instance' do
645
+ expect_any_instance_of(described_class).to receive(:first).and_return(nil)
646
+ expect_any_instance_of(described_class).to receive(:new).and_call_original
647
+ expect(Post.first_or_initialize).to be_new_record
648
+ end
649
+ end
650
+ end
651
+
652
+ describe '#first!' do
653
+ context 'when there are posts' do
654
+ let(:post) { posts.first }
655
+
656
+ before { post }
657
+
658
+ it 'returns the first post' do
659
+ expect_any_instance_of(described_class).to receive(:first).and_return(post)
660
+ expect(Post.first!).to eq post
661
+ end
662
+ end
663
+
664
+ context 'when there are no posts' do
665
+ it 'raises a RecordNotFound exception with a meaningful message' do
666
+ expect_any_instance_of(described_class).to receive(:first).and_return(nil)
667
+ expect { Post['1'].first! }.to raise_error Cequel::Record::RecordNotFound,
668
+ "Couldn't find record with keys: blog_subdomain: 1"
669
+ end
670
+ end
671
+ end
672
+
631
673
  describe '#limit' do
632
674
  let(:records) { blogs }
633
675
 
@@ -661,11 +703,6 @@ describe Cequel::Record::RecordSet do
661
703
  context 'simple primary key' do
662
704
  let(:records) { blogs }
663
705
 
664
- it 'should correctly query for simple primary key with two arguments' do
665
- expect(Blog.where(:subdomain, 'blog-0'))
666
- .to eq(blogs.first(1))
667
- end
668
-
669
706
  it 'should correctly query for simple primary key with hash argument' do
670
707
  expect(Blog.where(subdomain: 'blog-0'))
671
708
  .to eq(blogs.first(1))
@@ -708,7 +745,7 @@ describe Cequel::Record::RecordSet do
708
745
 
709
746
  context 'secondary indexed column' do
710
747
  it 'should query for secondary indexed columns with two arguments' do
711
- expect(Post.where(:author_id, uuids.first).map(&:permalink)).
748
+ expect(Post.where(author_id: uuids.first).map(&:permalink)).
712
749
  to eq(%w(cequel0 cequel2 cequel4))
713
750
  end
714
751
 
@@ -723,13 +760,13 @@ describe Cequel::Record::RecordSet do
723
760
  end
724
761
 
725
762
  it 'should not allow chaining of multiple columns' do
726
- expect { Post.where(:author_id, uuids.first).
727
- where(:author_name, 'Mat Brown') }.
763
+ expect { Post.where(author_id: uuids.first).
764
+ where(author_name: 'Mat Brown') }.
728
765
  to raise_error(Cequel::Record::IllegalQuery)
729
766
  end
730
767
 
731
768
  it 'should cast argument for column' do
732
- expect(Post.where(:author_id, uuids.first.to_s).map(&:permalink)).
769
+ expect(Post.where(author_id: uuids.first.to_s).map(&:permalink)).
733
770
  to eq(%w(cequel0 cequel2 cequel4))
734
771
  end
735
772
  end
@@ -753,14 +790,14 @@ describe Cequel::Record::RecordSet do
753
790
 
754
791
  context 'nonexistent column' do
755
792
  it 'should raise ArgumentError if column is not recognized' do
756
- expect { Post.where(:bogus, 'Business') }.
793
+ expect { Post.where(bogus: 'Business') }.
757
794
  to raise_error(ArgumentError)
758
795
  end
759
796
  end
760
797
 
761
798
  context 'non-indexed column' do
762
799
  it 'should raise ArgumentError if column is not indexed' do
763
- expect { Post.where(:title, 'Cequel 0') }.
800
+ expect { Post.where(title: 'Cequel 0') }.
764
801
  to raise_error(ArgumentError)
765
802
  end
766
803
  end
@@ -73,10 +73,10 @@ describe Cequel::Schema::Keyspace do
73
73
  })
74
74
  end
75
75
 
76
- it "raises an error if a class other than SimpleStrategy is given" do
76
+ it "raises an error if a class other than SimpleStrategy is given" do
77
77
  expect {
78
78
  keyspace.create! class: "NetworkTopologyStrategy", replication_factor: 2
79
- }.to raise_error
79
+ }.to raise_error(RuntimeError)
80
80
  end
81
81
  end
82
82
 
@@ -39,6 +39,7 @@ RSpec.configure do |config|
39
39
 
40
40
  config.filter_run :focus => true
41
41
  config.run_all_when_everything_filtered = true
42
+ config.order = "random"
42
43
  end
43
44
 
44
45
  if defined? byebug
@@ -18,7 +18,6 @@ describe Cequel::SpecSupport::Preparation do
18
18
  expect(prep.sync_schema).to eq prep
19
19
  end
20
20
 
21
-
22
21
  context "existing keyspace" do
23
22
  it "can be deleted" do
24
23
  prep.drop_keyspace
@@ -46,8 +45,8 @@ describe Cequel::SpecSupport::Preparation do
46
45
  end
47
46
 
48
47
  context "keyspace doesn't exist" do
49
- before do
50
- Cequel::Record.connection.schema.drop!
48
+ before(:each) do
49
+ Cequel::Record.connection.schema.drop!
51
50
  end
52
51
 
53
52
  it "doesn't cause failure upon drop requests" do
@@ -60,13 +59,19 @@ describe Cequel::SpecSupport::Preparation do
60
59
  end
61
60
 
62
61
  it "causes #sync_schema to fail" do
63
- expect{ prep.sync_schema }.to raise_error
62
+ expect{ prep.sync_schema }.to raise_error(Cassandra::Errors::InvalidError)
64
63
  end
65
64
  end
66
65
 
67
66
  # background
68
67
 
69
- after { Cequel::Record.connection.schema.create! rescue nil }
68
+ after(:each) do
69
+ begin
70
+ Cequel::Record.connection.schema.create!
71
+ rescue
72
+ nil
73
+ end
74
+ end
70
75
 
71
76
  matcher :contain_table do |table_name|
72
77
  match do |keyspace|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -29,42 +29,36 @@ authors:
29
29
  autorequire:
30
30
  bindir: bin
31
31
  cert_chain: []
32
- date: 2015-05-07 00:00:00.000000000 Z
32
+ date: 2015-09-03 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activemodel
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '3.1'
41
- - - "<"
38
+ - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '5.0'
40
+ version: '4.0'
44
41
  type: :runtime
45
42
  prerelease: false
46
43
  version_requirements: !ruby/object:Gem::Requirement
47
44
  requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: '3.1'
51
- - - "<"
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '5.0'
47
+ version: '4.0'
54
48
  - !ruby/object:Gem::Dependency
55
49
  name: cassandra-driver
56
50
  requirement: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '1.0'
54
+ version: '2.0'
61
55
  type: :runtime
62
56
  prerelease: false
63
57
  version_requirements: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: '1.0'
61
+ version: '2.0'
68
62
  - !ruby/object:Gem::Dependency
69
63
  name: appraisal
70
64
  requirement: !ruby/object:Gem::Requirement
@@ -325,14 +319,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
325
319
  requirements:
326
320
  - - ">="
327
321
  - !ruby/object:Gem::Version
328
- version: '1.9'
322
+ version: '2.0'
329
323
  required_rubygems_version: !ruby/object:Gem::Requirement
330
324
  requirements:
331
325
  - - ">="
332
326
  - !ruby/object:Gem::Version
333
327
  version: '0'
334
328
  requirements:
335
- - Cassandra >= 1.2.0
329
+ - Cassandra >= 2.0.0
336
330
  rubyforge_project:
337
331
  rubygems_version: 2.4.5
338
332
  signing_key: