right_support 2.9.3 → 2.9.4

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: 37afc64ef433ebff859d8ceee0fb88c158609480
4
- data.tar.gz: cee57ea2de6dca374c35df0337af297192d01176
3
+ metadata.gz: f8cb5d377a3622ac5ba6240f5fb6e3554596f664
4
+ data.tar.gz: 4c77349b228d4a892a956d5afcd4284ff4865bd9
5
5
  SHA512:
6
- metadata.gz: 27c7985c33dca1f7a28b811ea02849d93b1ecc53feecbb83e7e08594bb1008e1d31ca3a8d7f0910892235a4b01be62fd37342673ca2462e172f3dcb2321af6b0
7
- data.tar.gz: 9a30f91c3411fa31619b67f24f6bd8611b7fc1e7fe28c2cb0f90e39bdbec6094624b6463ee519bd9e0e556775f6c32917449e58f9879beb76a11902660cdd4e5
6
+ metadata.gz: d32d8853b71c7579647a687237187925fe12e3e0942d51e827751b8adb24500e53107aa0ec5f7fc2fb28fbec6b2a91591ac0bacf5cd48d555edd179d3ddbf1d5
7
+ data.tar.gz: 917e614a451fa81bea1ae1203168650be8bd392cfe44082d28580bce1ed3eab6cdeeb4498bc9767b75466fda4413255766d385300941960260418b8127944b2b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.9.3
1
+ 2.9.4
@@ -220,13 +220,14 @@ module RightSupport::DB
220
220
  # As part of constructing the keyspace name, determine if we have a trailing namespace to
221
221
  # append. Applicable to rails_env test and integration, otherwise defaults to nil.
222
222
  def namespace(env)
223
- case env
223
+ ( config[env] && config[env]['namespace'] ) || begin
224
+ case env
224
225
  when 'test'
225
- nspace = 'testns'
226
+ 'testns'
226
227
  when 'integration'
227
- nspace = File.read('/etc/namespace').strip if File.file?('/etc/namespace')
228
+ File.read('/etc/namespace').strip if File.file?('/etc/namespace')
229
+ end
228
230
  end
229
- nspace
230
231
  end
231
232
 
232
233
  # Return current keyspace names as Array of String (any keyspace that has been used this session).
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: right_support 2.9.3 ruby lib
5
+ # stub: right_support 2.9.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "right_support"
9
- s.version = "2.9.3"
9
+ s.version = "2.9.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
14
- s.date = "2015-11-02"
14
+ s.date = "2016-03-16"
15
15
  s.description = "A toolkit of useful, reusable foundation code created by RightScale."
16
16
  s.email = "support@rightscale.com"
17
17
  s.extra_rdoc_files = [
@@ -149,7 +149,7 @@ Gem::Specification.new do |s|
149
149
  ]
150
150
  s.homepage = "https://github.com/rightscale/right_support"
151
151
  s.licenses = ["MIT"]
152
- s.rubygems_version = "2.2.3"
152
+ s.rubygems_version = "2.5.1"
153
153
  s.summary = "Reusable foundation code."
154
154
 
155
155
  if s.respond_to? :specification_version then
@@ -1,6 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RightSupport::DB::CassandraModel do
4
+ let(:config) do
5
+ {
6
+ 'test' => {'server' => 'connection'},
7
+ 'developemnt' => {'server' => 'connection1'},
8
+ 'integration' => {'server' => 'connection2', 'namespace' => 'bronze42' }
9
+ }
10
+ end
11
+
12
+ # Ensure we at try to put the class back the way it was beforehand.
13
+ # even if that prior state was invalid.
14
+ around do |example|
15
+ original = RightSupport::DB::CassandraModel.config rescue nil
16
+ RightSupport::DB::CassandraModel.config = config
17
+ example.call
18
+ RightSupport::DB::CassandraModel.config = original
19
+ end
4
20
 
5
21
  class Cassandra
6
22
  class OrderedHash < Hash
@@ -212,6 +228,21 @@ describe RightSupport::DB::CassandraModel do
212
228
  end
213
229
  end
214
230
 
231
+ context :namespace do
232
+ it 'returns testns for the test environment' do
233
+ RightSupport::DB::CassandraModel.namespace('test').should eq 'testns'
234
+ end
235
+ it 'uses the config-given namespace for the integration environment' do
236
+ RightSupport::DB::CassandraModel.config = config
237
+ RightSupport::DB::CassandraModel.namespace('integration').should eq 'bronze42'
238
+ end
239
+ it 'returns nil for any other environment' do
240
+ %w{production staging development frobnication}.each do |env|
241
+ RightSupport::DB::CassandraModel.namespace('production').should be(nil)
242
+ RightSupport::DB::CassandraModel.namespace('production').should be(nil)
243
+ end
244
+ end
245
+ end
215
246
  context :insert do
216
247
  it 'inserts a row by using the class method' do
217
248
  RightSupport::DB::CassandraModel.insert(@key, @attrs, @opt).should be_true
@@ -290,7 +321,7 @@ describe RightSupport::DB::CassandraModel do
290
321
  it 'returns row for the specified key' do
291
322
  rows = RightSupport::DB::CassandraModel.get_indexed(@index, @index_key)
292
323
  rows.should be_a_kind_of(Array)
293
- rows.size.should == 1
324
+ rows.size.should eq 1
294
325
  rows.first.should be_a_kind_of(RightSupport::DB::CassandraModel)
295
326
  end
296
327
 
@@ -313,7 +344,7 @@ describe RightSupport::DB::CassandraModel do
313
344
  @conn.should_receive(:create_idx_clause).with([@expr], key2, 2).and_return(@clause).once
314
345
  @conn.should_receive(:get_indexed_slices).with(@column_family, @clause, nil, {}).and_return(rows2).once
315
346
  rows = RightSupport::DB::CassandraModel.get_indexed(@index, @index_key)
316
- rows.size.should == 3
347
+ rows.size.should eq 3
317
348
  rows.inject({}) { |s, r| s[r.key] = r.attributes; s }.should == {key1 => cols, key2 => cols, key3 => cols}
318
349
  ensure
319
350
  RightSupport::DB::CassandraModel.instance_eval { remove_const :DEFAULT_COUNT }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.3
4
+ version: 2.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Spataro
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-11-03 00:00:00.000000000 Z
16
+ date: 2016-03-16 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  requirements: []
242
242
  rubyforge_project:
243
- rubygems_version: 2.2.3
243
+ rubygems_version: 2.5.1
244
244
  signing_key:
245
245
  specification_version: 4
246
246
  summary: Reusable foundation code.