active_record_host_pool 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/active_record_host_pool/connection_adapter_mixin.rb +5 -0
- data/test/helper.rb +4 -12
- data/test/test_arhp.rb +10 -1
- metadata +3 -130
@@ -67,6 +67,11 @@ module ActiveRecordHostPool
|
|
67
67
|
@_cached_connection_object_id = @connection.object_id
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
# prevent different databases from sharing the same query cache
|
72
|
+
def cache_sql(sql, *args)
|
73
|
+
super(_host_pool_current_database.to_s + "/" + sql, *args)
|
74
|
+
end
|
70
75
|
end
|
71
76
|
end
|
72
77
|
|
data/test/helper.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'test/unit'
|
2
3
|
|
3
|
-
if defined?(Debugger)
|
4
|
-
::Debugger.start
|
5
|
-
::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
|
6
|
-
end
|
7
|
-
|
8
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
4
|
require 'active_record_host_pool'
|
11
5
|
require 'logger'
|
6
|
+
require 'mocha/setup'
|
12
7
|
|
13
8
|
RAILS_ENV = "test"
|
14
9
|
|
@@ -24,10 +19,7 @@ end
|
|
24
19
|
|
25
20
|
ActiveRecord::Base.configurations = config
|
26
21
|
|
27
|
-
|
28
|
-
require 'active_support/test_case'
|
29
|
-
|
30
|
-
class ActiveSupport::TestCase
|
22
|
+
module ARHPTestSetup
|
31
23
|
private
|
32
24
|
def arhp_create_databases
|
33
25
|
ActiveRecord::Base.configurations.each do |name, conf|
|
data/test/test_arhp.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require File.expand_path('helper', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
class ActiveRecordHostPoolTest <
|
3
|
+
class ActiveRecordHostPoolTest < Test::Unit::TestCase
|
4
|
+
include ARHPTestSetup
|
4
5
|
def setup
|
5
6
|
arhp_create_databases
|
6
7
|
arhp_create_models
|
@@ -31,6 +32,14 @@ class ActiveRecordHostPoolTest < ActiveSupport::TestCase
|
|
31
32
|
assert Test1.connection.is_a?(ActiveRecordHostPool::ConnectionProxy)
|
32
33
|
end
|
33
34
|
|
35
|
+
def test_should_not_share_a_query_cache
|
36
|
+
Test1.create(:val => 'foo')
|
37
|
+
Test2.create(:val => 'foobar')
|
38
|
+
Test1.connection.cache do
|
39
|
+
assert Test1.first.val != Test2.first.val
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
34
43
|
def test_object_creation
|
35
44
|
Test1.create(:val => 'foo')
|
36
45
|
assert_equal("arhp_test_1", current_database(Test1))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_host_pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,134 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rake
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: shoulda
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: mysql
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: mysql2
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: mocha
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 0.11.0
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 0.11.0
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: test-unit
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 2.5.1
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 2.5.1
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: appraisal
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: debugger
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
30
|
description: ''
|
159
31
|
email:
|
160
32
|
- ben@gimbo.net
|
@@ -195,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
67
|
version: '0'
|
196
68
|
requirements: []
|
197
69
|
rubyforge_project:
|
198
|
-
rubygems_version: 1.8.
|
70
|
+
rubygems_version: 1.8.25
|
199
71
|
signing_key:
|
200
72
|
specification_version: 3
|
201
73
|
summary: Allow ActiveRecord to share a connection to multiple databases on the same
|
@@ -205,3 +77,4 @@ test_files:
|
|
205
77
|
- test/helper.rb
|
206
78
|
- test/schema.rb
|
207
79
|
- test/test_arhp.rb
|
80
|
+
has_rdoc:
|