diff options
Diffstat (limited to 'test/support/fake_record.rb')
-rw-r--r-- | test/support/fake_record.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/support/fake_record.rb b/test/support/fake_record.rb index cdea690a7b..a0fa79d519 100644 --- a/test/support/fake_record.rb +++ b/test/support/fake_record.rb @@ -3,7 +3,7 @@ module FakeRecord end class Connection - attr_reader :tables + attr_reader :tables, :columns_hash def initialize @tables = %w{ users photos developers products} @@ -19,6 +19,9 @@ module FakeRecord Column.new('price', :decimal) ] } + @columns_hash = { + 'users' => Hash[@columns['users'].map { |x| [x.name, x] }] + } @primary_keys = { 'users' => 'id' } @@ -79,6 +82,14 @@ module FakeRecord def with_connection yield connection end + + def table_exists? name + connection.tables.include? name.to_s + end + + def columns_hash + connection.columns_hash + end end class Base |