Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ActiverecordTestConnector shouldn't be a class

  • Loading branch information...
commit 36159385c8a5837fc63fe901ebe0a88205b5ce8d 1 parent dfc3044
@mislav mislav authored
Showing with 10 additions and 8 deletions.
  1. +10 −8 spec/finders/activerecord_test_connector.rb
View
18 spec/finders/activerecord_test_connector.rb
@@ -5,9 +5,11 @@
$query_count = $query_sql = nil
-class ActiverecordTestConnector
- cattr_accessor :able_to_connect
- cattr_accessor :connected
+module ActiverecordTestConnector
+ extend self
+
+ attr_accessor :able_to_connect
+ attr_accessor :connected
FIXTURES_PATH = File.expand_path('../../fixtures', __FILE__)
@@ -15,7 +17,7 @@ class ActiverecordTestConnector
self.connected = false
self.able_to_connect = true
- def self.setup
+ def setup
unless self.connected || !self.able_to_connect
setup_connection
load_schema
@@ -29,12 +31,12 @@ def self.setup
private
- def self.add_load_path(path)
+ def add_load_path(path)
dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
dep.autoload_paths.unshift path
end
- def self.setup_connection
+ def setup_connection
db = ENV['DB'].blank?? 'sqlite3' : ENV['DB']
configurations = YAML.load_file(File.expand_path('../../database.yml', __FILE__))
@@ -49,14 +51,14 @@ def self.setup_connection
prepare ActiveRecord::Base.connection
end
- def self.load_schema
+ def load_schema
ActiveRecord::Base.silence do
ActiveRecord::Migration.verbose = false
load File.join(FIXTURES_PATH, 'schema.rb')
end
end
- def self.prepare(conn)
+ def prepare(conn)
class << conn
IGNORED_SQL = /^(?:PRAGMA|SELECT (?:currval|CAST|@@IDENTITY|@@ROWCOUNT)|SHOW FIELDS)\b/
Please sign in to comment.
Something went wrong with that request. Please try again.