diff --git a/test/unit/migration_test.rb b/test/unit/migration_test.rb index df8a7af..17d4117 100644 --- a/test/unit/migration_test.rb +++ b/test/unit/migration_test.rb @@ -25,6 +25,18 @@ def test_engine_migrations_can_run_up assert table_exists?('tests') assert table_exists?('others') end + + def test_engine_migrations_can_upgrade_incrementally + Engines.plugins[:test_migration].migrate(1) + assert table_exists?('tests') + assert !table_exists?('others') + assert_equal 1, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration]) + + + Engines.plugins[:test_migration].migrate(2) + assert table_exists?('others') + assert_equal 2, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration]) + end def test_generator_creates_plugin_migration_file Rails::Generator::Scripts::Generate.new.run(['plugin_migration', 'test_migration'], :quiet => true)