= Ruby Gem: ActiveRecord migration mock object for testing Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com Copyright:: Copyright (c) 2009 Joel Parker Henderson License:: CreativeCommons License, Non-commercial Share Alike License:: LGPL, GNU Lesser General Public License ==Example Migration class CreateFoosMigration < ActiveRecordMigrationMock def self.up create_table 'foos', :force => true do |t| t.column :abc, :integer t.column :def, :string end add_index 'foos', 'abc' end def self.down drop_table 'foos' end end ==Example Usage CreateFoosMigration.up ActiveRecordMigration.has_table?('foos') => true ActiveRecordMigration.has_table?('bars') => false tables = ActiveRecordMigration.tables table = ActiveRecordMigration.tables['foo'] table.has_column?('abc') => true table.has_column?('xyz') => false table.has_index?('abc') => true table.has_index?('def') => false columns = table.columns column = table.columns['abc'] column.type => :integer column = table.columns['def'] column.type => :string indexes = table.indexes index = table.indexes['abc'] index.table_name => 'foos' index.column_name => 'abc'