aboutsummaryrefslogtreecommitdiffstats
path: root/test/support
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-11-19 18:57:36 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-11-19 18:57:36 -0800
commitc5f9fbf0d66ddeaf1fb2992e696ffe88244bda82 (patch)
tree2f876d9e77610f611fb2cbb3ef0e7bdea485229b /test/support
parent9a0b1c4001869a05200effed883a8ef8bd3ddac9 (diff)
downloadrails-c5f9fbf0d66ddeaf1fb2992e696ffe88244bda82.tar.gz
rails-c5f9fbf0d66ddeaf1fb2992e696ffe88244bda82.tar.bz2
rails-c5f9fbf0d66ddeaf1fb2992e696ffe88244bda82.zip
calling cache methods against the connection
Diffstat (limited to 'test/support')
-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