global_uid 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require "active_record"
2
- require "system_timer" if Gem.available?("system_timer")
2
+ require "active_support/all"
3
+
3
4
  require "timeout"
4
5
 
5
6
  module GlobalUid
@@ -0,0 +1,20 @@
1
+ test:
2
+ adapter: mysql
3
+ encoding: utf8
4
+ database: global_uid_test
5
+ username: root
6
+ password:
7
+
8
+ test_id_server_1:
9
+ adapter: mysql
10
+ encoding: utf8
11
+ database: global_uid_test_id_server_1
12
+ username: root
13
+ password:
14
+
15
+ test_id_server_2:
16
+ adapter: mysql
17
+ encoding: utf8
18
+ database: global_uid_test_id_server_2
19
+ username: root
20
+ password:
@@ -1,19 +1,19 @@
1
1
  test:
2
- adapter: mysql2
2
+ adapter: mysql
3
3
  encoding: utf8
4
4
  database: global_uid_test
5
5
  username: root
6
6
  password:
7
7
 
8
8
  test_id_server_1:
9
- adapter: mysql2
9
+ adapter: mysql
10
10
  encoding: utf8
11
11
  database: global_uid_test_id_server_1
12
12
  username: root
13
13
  password:
14
14
 
15
15
  test_id_server_2:
16
- adapter: mysql2
16
+ adapter: mysql
17
17
  encoding: utf8
18
18
  database: global_uid_test_id_server_2
19
19
  username: root
@@ -200,7 +200,7 @@ class GlobalUIDTest < ActiveSupport::TestCase
200
200
  setup do
201
201
  reset_connections!
202
202
  @old_size = GlobalUid::Base.get_connections.size # prime them
203
- GlobalUid::Base.get_connections.first.stubs(:execute).raises(GlobalUid::TimeoutException)
203
+ GlobalUid::Base.get_connections.first.stubs(:insert).raises(GlobalUid::TimeoutException)
204
204
  # trigger the failure -- have to do it it a bunch of times, as one call might not hit the server
205
205
  # Even so there's a 1/(2^32) possibility of this test failing.
206
206
  32.times do WithGlobalUID.create! end
@@ -227,7 +227,7 @@ class GlobalUIDTest < ActiveSupport::TestCase
227
227
  # would prefer to do the below, but need Mocha 0.9.10 to do so
228
228
  # ActiveRecord::ConnectionAdapters::MysqlAdapter.any_instance.stubs(:execute).raises(ActiveRecord::StatementInvalid)
229
229
  GlobalUid::Base.with_connections do |cx|
230
- cx.stubs(:execute).raises(ActiveRecord::StatementInvalid)
230
+ cx.stubs(:insert).raises(ActiveRecord::StatementInvalid)
231
231
  end
232
232
  end
233
233
 
@@ -355,7 +355,7 @@ class GlobalUIDTest < ActiveSupport::TestCase
355
355
  end
356
356
 
357
357
  def show_create_sql(klass, table)
358
- klass.connection.select_all("show create table #{table}")[0]["Create Table"]
358
+ klass.connection.select_rows("show create table #{table}")[0][1]
359
359
  end
360
360
  end
361
361