Patch #28934 » use_migration_context_with_test.patch
| lib/redmine/plugin.rb (working copy) | ||
|---|---|---|
| 479 | 479 |
def migrate_plugin(plugin, version) |
| 480 | 480 |
self.current_plugin = plugin |
| 481 | 481 |
return if current_version(plugin) == version |
| 482 |
migrate(plugin.migration_directory, version)
|
|
| 482 |
ActiveRecord::MigrationContext.new(plugin.migration_directory).migrate(version)
|
|
| 483 | 483 |
end |
| 484 | 484 | |
| 485 | 485 |
def current_version(plugin=current_plugin) |
| test/unit/lib/redmine/plugin_test.rb (working copy) | ||
|---|---|---|
| 183 | 183 |
Rails.logger.expects(:warn) |
| 184 | 184 |
@klass.register(:bar) { settings :partial => 'foo/settings' }
|
| 185 | 185 |
end |
| 186 | ||
| 187 |
def test_migrate_redmine_plugin |
|
| 188 |
@klass.register :foo do |
|
| 189 |
name 'Foo plugin' |
|
| 190 |
version '0.0.1' |
|
| 191 |
end |
|
| 192 | ||
| 193 |
assert Redmine::Plugin.migrate('foo')
|
|
| 194 |
end |
|
| 186 | 195 |
end |