Class: MigrationTestHelper::Schema
- Inherits:
-
Object
- Object
- MigrationTestHelper::Schema
- Includes:
- Connection, Test::Unit::Assertions
- Defined in:
- lib/migration_test_helper.rb
Instance Method Summary collapse
-
#initialize ⇒ Schema
constructor
:nodoc:.
- #table(name) {|table| ... } ⇒ Object
-
#verify ⇒ Object
:nodoc:.
Methods included from Connection
Constructor Details
#initialize ⇒ Schema
:nodoc:
105 106 107 |
# File 'lib/migration_test_helper.rb', line 105 def initialize #:nodoc: @tables = [] end |
Instance Method Details
#table(name) {|table| ... } ⇒ Object
109 110 111 112 113 114 |
# File 'lib/migration_test_helper.rb', line 109 def table(name) table = Table.new(name) yield table table.verify @tables << table end |
#verify ⇒ Object
:nodoc:
116 117 118 119 120 |
# File 'lib/migration_test_helper.rb', line 116 def verify #:nodoc: actual_tables = conn.tables.reject {|t| t == 'schema_info' || t == 'schema_migrations' } expected_tables = @tables.map {|t| t.name } assert_equal expected_tables.sort, actual_tables.sort, 'wrong tables in schema' end |