data_store 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ##0.0.9
2
+
3
+ * Bug fix: connect to database in case of a DATABASE_URL now works wiht JRuby as well
4
+
1
5
  ##0.0.8
2
6
 
3
7
  * Connect to database in case of a DATABASE_URL environment variable (used with Heroku)
@@ -36,10 +36,10 @@ module DataStore
36
36
  # Return the database object to which its connected.
37
37
  def database
38
38
  @database ||= begin
39
- if RUBY_PLATFORM == 'java'
40
- Sequel.connect(jdbc_settings)
41
- elsif ENV['DATABASE_URL']
39
+ if ENV['DATABASE_URL']
42
40
  Sequel.connect(ENV['DATABASE_URL'])
41
+ elsif RUBY_PLATFORM == 'java'
42
+ Sequel.connect(jdbc_settings)
43
43
  else
44
44
  Sequel.connect(database_settings)
45
45
  end
@@ -1,3 +1,3 @@
1
1
  module DataStore
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -31,12 +31,23 @@ class ConnectorTest < Test::Unit::TestCase
31
31
 
32
32
  context 'Database on Heroku' do
33
33
 
34
- should 'connect on the base of the DATABASE_URL environment variable in exist' do
35
- ENV['DATABASE_URL'] = 'postgres://postgres@localhost/data_store_test'
34
+ setup do
35
+ ENV['DATABASE_URL'] = if RUBY_PLATFORM == 'java'
36
+ "jdbc:postgresql://localhost/data_store_test?user=postgres"
37
+ else
38
+ 'postgres://postgres@localhost/data_store_test'
39
+ end
40
+ end
41
+
42
+ should 'connect on the base of the DATABASE_URL environment variable if exists' do
36
43
  DataStore.configuration.stubs(:database_config_file).returns('')
37
- connector = DataStore::Connector.new
38
- assert connector.database.inspect.match(ENV['DATABASE_URL'])
39
- connector.database.disconnect
44
+ @connector = DataStore::Connector.new
45
+ assert @connector.database.inspect.gsub('?','').match(ENV['DATABASE_URL']) #Remove ? otherwise match fails
46
+ end
47
+
48
+ teardown do
49
+ @connector.database.disconnect
50
+ ENV['DATABASE_URL'] = nil
40
51
  end
41
52
 
42
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-15 00:00:00.000000000 Z
12
+ date: 2013-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: 210819487432911081
97
+ hash: 2320272369353145046
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: 210819487432911081
106
+ hash: 2320272369353145046
107
107
  requirements: []
108
108
  rubyforge_project:
109
109
  rubygems_version: 1.8.24