Method: Rails::Generators::Testing::Assertions#assert_migration
- Defined in:
- railties/lib/rails/generators/testing/assertions.rb
permalink #assert_migration(relative, *contents, &block) ⇒ Object
Asserts a given migration exists. You need to supply an absolute path or a path relative to the configured destination:
assert_migration "db/migrate/create_products.rb"
This method manipulates the given path and tries to find any migration which matches the migration name. For example, the call above is converted to:
assert_file "db/migrate/003_create_products.rb"
Consequently, assert_migration accepts the same arguments has assert_file.
62 63 64 65 66 |
# File 'railties/lib/rails/generators/testing/assertions.rb', line 62 def assert_migration(relative, *contents, &block) file_name = migration_file_name(relative) assert file_name, "Expected migration #{relative} to exist, but was not found" assert_file file_name, *contents, &block end |