aboutsummaryrefslogtreecommitdiffstats
path: root/test/support/fake_record.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/support/fake_record.rb')
-rw-r--r--test/support/fake_record.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/support/fake_record.rb b/test/support/fake_record.rb
index ddef7b66c5..79182f86bd 100644
--- a/test/support/fake_record.rb
+++ b/test/support/fake_record.rb
@@ -3,9 +3,10 @@ module FakeRecord
end
class Connection
- attr_reader :tables, :columns_hash, :visitor
+ attr_reader :tables, :columns_hash
+ attr_accessor :visitor
- def initialize(visitor)
+ def initialize(visitor = nil)
@tables = %w{ users photos developers products}
@columns = {
'users' => [
@@ -50,6 +51,10 @@ module FakeRecord
"\"#{name.to_s}\""
end
+ def schema_cache
+ self
+ end
+
def quote thing, column = nil
if column && column.type == :integer
return 'NULL' if thing.nil?
@@ -79,7 +84,8 @@ module FakeRecord
def initialize
@spec = Spec.new(:adapter => 'america')
- @connection = Connection.new(Arel::Visitors::ToSql.new(self))
+ @connection = Connection.new
+ @connection.visitor = Arel::Visitors::ToSql.new(connection)
end
def with_connection
@@ -93,6 +99,10 @@ module FakeRecord
def columns_hash
connection.columns_hash
end
+
+ def schema_cache
+ connection
+ end
end
class Base