Class: Birdbath::Schema
- Inherits:
-
Object
- Object
- Birdbath::Schema
- Includes:
- Connection, Test::Unit::Assertions
- Defined in:
- lib/birdbath.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:
106 107 108 |
# File 'lib/birdbath.rb', line 106 def initialize #:nodoc: @tables = [] end |
Instance Method Details
#table(name) {|table| ... } ⇒ Object
110 111 112 113 114 115 |
# File 'lib/birdbath.rb', line 110 def table(name) table = Table.new(name) yield table table.verify @tables << table end |
#verify ⇒ Object
:nodoc:
117 118 119 120 121 |
# File 'lib/birdbath.rb', line 117 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 |