File tree 6 files changed +16
-12
lines changed
lib/active_record/connection_adapters
mysqlplus_adapter/deferrable
6 files changed +16
-12
lines changed Original file line number Diff line number Diff line change
1
+ # coding: utf-8
2
+
1
3
require 'rake'
2
4
require 'rake/testtask'
3
5
require 'test/helper'
Original file line number Diff line number Diff line change 11
11
12
12
begin
13
13
require_library_or_gem ( 'fastthread' )
14
- rescue => LoadError
14
+ rescue LoadError
15
15
$stderr. puts "'gem install fastthread' for better performance"
16
16
end
17
17
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ def find_every_with_defer(options) #:nodoc:
121
121
records
122
122
end
123
123
124
- def preload_deferred_includes ( include_associations , options )
124
+ def preload_deferred_includes ( include_associations , options ) #:nodoc:
125
125
options [ :defer ] ? ( Array ( include_associations ) << :defer ) : include_associations
126
126
end
127
127
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def initialize( &deferrable )
15
15
# back in on completion.
16
16
#
17
17
def defer! ( deferrable )
18
- @result = Thread . new ( deferrable ) do |deferrable |
18
+ @result = :: Thread . new ( deferrable ) do |deferrable |
19
19
begin
20
20
deferrable . call
21
21
rescue => exception
@@ -38,7 +38,7 @@ def method_missing(*args, &block)
38
38
# Re-raise any Exceptions from the background Thread.
39
39
#
40
40
def validate!
41
- raise @_result if @_result . is_a? ( Exception )
41
+ raise @_result if @_result . is_a? ( :: Exception )
42
42
end
43
43
44
44
end
Original file line number Diff line number Diff line change 1
1
require "#{ File . dirname ( __FILE__ ) } /../helper"
2
+
2
3
Mysqlplus ::Test . prepare!
3
4
4
- class MacroTest < ActiveRecord ::TestCase
5
+ class MacroTest < ActiveSupport ::TestCase
5
6
6
7
def teardown
7
8
ActiveRecord ::Base . clear_all_connections!
8
- ActiveRecord ::Base . establish_connection ( Mysqlplus ::Test ::CONNECTION )
9
+ ActiveRecord ::Base . establish_connection ( Mysqlplus ::Test ::CONNECTION_SPEC )
9
10
super
10
11
end
11
12
Original file line number Diff line number Diff line change 1
1
require 'rubygems'
2
+ require 'mocha'
2
3
require 'active_support'
3
4
require 'active_support/test_case'
4
5
require 'activerecord'
8
9
module Mysqlplus
9
10
class Test
10
11
11
- CONNECTION = { :adapter => 'mysqlplus' ,
12
- :username => 'root' ,
13
- :database => 'mysql' ,
14
- :pool => 5 ,
15
- :warmup => true }
12
+ CONNECTION_SPEC = { :adapter => 'mysqlplus' ,
13
+ :username => 'root' ,
14
+ :database => 'mysql' ,
15
+ :pool => 5 ,
16
+ :warmup => true }
16
17
17
18
MODELS_DIR = "#{ File . dirname ( __FILE__ ) } /models" . freeze
18
19
@@ -46,7 +47,7 @@ def test_files
46
47
private
47
48
48
49
def connect!
49
- ::ActiveRecord ::Base . establish_connection ( CONNECTION )
50
+ ::ActiveRecord ::Base . establish_connection ( CONNECTION_SPEC )
50
51
end
51
52
52
53
def require_models
You can’t perform that action at this time.
0 commit comments