diff options
author | Stefan Sprenger <stefan.sprenger@dkd.de> | 2011-05-27 08:25:56 +0200 |
---|---|---|
committer | Stefan Sprenger <stefan.sprenger@dkd.de> | 2011-05-27 08:25:56 +0200 |
commit | 9935c308f14df1eab1e1334dc007bae999dab92f (patch) | |
tree | f8d07ffbb90960ff461e3a032222dac3796acab3 | |
parent | 835c9cee3ede273030bae5dcf465176d64b287dd (diff) | |
download | rails-9935c308f14df1eab1e1334dc007bae999dab92f.tar.gz rails-9935c308f14df1eab1e1334dc007bae999dab92f.tar.bz2 rails-9935c308f14df1eab1e1334dc007bae999dab92f.zip |
Fix and test ENGINE_PATH and ENGINE_ROOT
-rw-r--r-- | railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt | 4 | ||||
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt b/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt index 0d7becad4f..aa87d1b50c 100644 --- a/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +++ b/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt @@ -1,7 +1,7 @@ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -ENGINE_ROOT = File.expand_path('../..', __FILE__) -ENGINE_PATH = File.expand_path('../../lib/<%= name -%>/engine', __FILE__) +ENGINE_ROOT = File.expand_path('../..', __FILE__) +ENGINE_PATH = File.expand_path('../../lib/<%= name -%>/engine', __FILE__) require 'rails/all' require 'rails/engine/commands' diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 32d7c58267..25663ef109 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -177,6 +177,14 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "bukkits.gemspec", /s.version = "0.0.1"/ end + def test_usage_of_engine_commands + run_generator + assert_file "script/rails", /ENGINE_PATH = File.expand_path\('..\/..\/lib\/bukkits\/engine', __FILE__\)/ + assert_file "script/rails", /ENGINE_ROOT = File.expand_path\('..\/..', __FILE__\)/ + assert_file "script/rails", /require 'rails\/all'/ + assert_file "script/rails", /require 'rails\/engine\/commands/ + end + def test_shebang run_generator assert_file "script/rails", /#!\/usr\/bin\/env ruby/ |