diff options
author | Patrick Helm <ph@werbeboten.de> | 2012-04-12 16:25:28 +0200 |
---|---|---|
committer | Patrick Helm <ph@werbeboten.de> | 2012-04-12 16:25:28 +0200 |
commit | 0e49ef433093c0ed08c7df8609b0b9e3dae5150c (patch) | |
tree | 40528ff48ee7ac39439763192f9e75ffbf59c460 /railties/test | |
parent | 1db54dffaffb83c7a1dacb4db7e4204c7bd1ddba (diff) | |
download | rails-0e49ef433093c0ed08c7df8609b0b9e3dae5150c.tar.gz rails-0e49ef433093c0ed08c7df8609b0b9e3dae5150c.tar.bz2 rails-0e49ef433093c0ed08c7df8609b0b9e3dae5150c.zip |
Provided fix for calling rake tasks within mountable engines
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/railties/engine_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 5e93a8e783..1650a15080 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -112,6 +112,37 @@ module RailtiesTest end end + test "mountable engine should copy migrations within engine_path" do + @plugin.write "lib/bukkits.rb", <<-RUBY + module Bukkits + class Engine < ::Rails::Engine + isolate_namespace Bukkits + end + end + RUBY + + @plugin.write "db/migrate/0_add_first_name_to_users.rb", <<-RUBY + class AddFirstNameToUsers < ActiveRecord::Migration + end + RUBY + + @plugin.write "Rakefile", <<-RUBY + APP_RAKEFILE = '#{app_path}/Rakefile' + load 'rails/tasks/engine.rake' + RUBY + + add_to_config "ActiveRecord::Base.timestamped_migrations = false" + + boot_rails + + Dir.chdir(@plugin.path) do + output = `bundle exec rake app:bukkits:install:migrations` + assert File.exists?("#{app_path}/db/migrate/0_add_first_name_to_users.bukkits.rb") + assert_match(/Copied migration 0_add_first_name_to_users.bukkits.rb from bukkits/, output) + assert_equal 1, Dir["#{app_path}/db/migrate/*.rb"].length + end + end + test "no rake task without migrations" do boot_rails require 'rake' |