active_record_host_pool 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/active_record_host_pool/pool_proxy.rb +1 -1
- data/test/database.yml +10 -0
- data/test/helper.rb +6 -1
- data/test/test_arhp.rb +4 -0
- metadata +3 -3
data/test/database.yml
CHANGED
data/test/helper.rb
CHANGED
@@ -34,7 +34,7 @@ class ActiveSupport::TestCase
|
|
34
34
|
|
35
35
|
def arhp_drop_databases
|
36
36
|
ActiveRecord::Base.configurations.each do |name, conf|
|
37
|
-
ActiveRecord::Base.connection.execute("DROP DATABASE #{conf['database']}")
|
37
|
+
ActiveRecord::Base.connection.execute("DROP DATABASE if exists #{conf['database']}")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -60,6 +60,11 @@ class ActiveSupport::TestCase
|
|
60
60
|
set_table_name "tests"
|
61
61
|
establish_connection("test_host_2_db_4")
|
62
62
|
end
|
63
|
+
|
64
|
+
class Test5 < ActiveRecord::Base
|
65
|
+
set_table_name "tests"
|
66
|
+
establish_connection("test_host_2_db_5")
|
67
|
+
end
|
63
68
|
EOL
|
64
69
|
end
|
65
70
|
|
data/test/test_arhp.rb
CHANGED
@@ -15,6 +15,10 @@ class ActiveRecordHostPoolTest < ActiveSupport::TestCase
|
|
15
15
|
assert(Test1.connection.raw_connection != Test4.connection.raw_connection)
|
16
16
|
end
|
17
17
|
|
18
|
+
def test_models_without_matching_usernames_should_not_share_a_connection
|
19
|
+
assert(Test4.connection.raw_connection != Test5.connection.raw_connection)
|
20
|
+
end
|
21
|
+
|
18
22
|
def test_should_select_on_correct_database
|
19
23
|
action_should_use_correct_database(:select_all, "select 1")
|
20
24
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_host_pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Osheroff
|