aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorunknown <jeko1@.npfit.nhs.uk>2009-02-03 13:03:47 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-02-16 20:22:02 +0100
commit2414fdb244cc0ba97620dd3f50e269d2e26c7392 (patch)
tree18e8f3ce8acd407d05c05a54ade4195de2a9a415 /railties/test
parent86d8f922828677e64892c166adf26cd421f0991a (diff)
downloadrails-2414fdb244cc0ba97620dd3f50e269d2e26c7392.tar.gz
rails-2414fdb244cc0ba97620dd3f50e269d2e26c7392.tar.bz2
rails-2414fdb244cc0ba97620dd3f50e269d2e26c7392.zip
Ensure template_runner can run script/* ruby scripts under Windows. [#1859 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/rails_template_runner_test.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/railties/test/generators/rails_template_runner_test.rb b/railties/test/generators/rails_template_runner_test.rb
index fcc020603d..56afc85eba 100644
--- a/railties/test/generators/rails_template_runner_test.rb
+++ b/railties/test/generators/rails_template_runner_test.rb
@@ -53,12 +53,12 @@ class RailsTemplateRunnerTest < GeneratorTestCase
end
def test_plugin_with_git_option_should_run_plugin_install
- expects_run_with_command("script/plugin install #{@git_plugin_uri}")
+ expects_run_ruby_script_with_command("script/plugin install #{@git_plugin_uri}")
run_template_method(:plugin, 'restful-authentication', :git => @git_plugin_uri)
end
def test_plugin_with_svn_option_should_run_plugin_install
- expects_run_with_command("script/plugin install #{@svn_plugin_uri}")
+ expects_run_ruby_script_with_command("script/plugin install #{@svn_plugin_uri}")
run_template_method(:plugin, 'restful-authentication', :svn => @svn_plugin_uri)
end
@@ -127,7 +127,7 @@ class RailsTemplateRunnerTest < GeneratorTestCase
end
def test_generate_should_run_script_generate_with_argument_and_options
- expects_run_with_command('script/generate model MyModel')
+ expects_run_ruby_script_with_command('script/generate model MyModel')
run_template_method(:generate, 'model', 'MyModel')
end
@@ -162,6 +162,12 @@ class RailsTemplateRunnerTest < GeneratorTestCase
assert_generated_file_with_data 'config/routes.rb', route_command
end
+ def test_run_ruby_script_should_add_ruby_to_command_in_win32_environment
+ ruby_command = RUBY_PLATFORM =~ /win32/ ? 'ruby ' : ''
+ expects_run_with_command("#{ruby_command}script/generate model MyModel")
+ run_template_method(:generate, 'model', 'MyModel')
+ end
+
protected
def run_template_method(method_name, *args, &block)
silence_generator do
@@ -174,6 +180,10 @@ class RailsTemplateRunnerTest < GeneratorTestCase
Rails::TemplateRunner.any_instance.stubs(:run).once.with(command, false)
end
+ def expects_run_ruby_script_with_command(command)
+ Rails::TemplateRunner.any_instance.stubs(:run_ruby_script).once.with(command,false)
+ end
+
def assert_rails_initializer_includes(data, message = nil)
message ||= "Rails::Initializer should include #{data}"
assert_generated_file 'config/environment.rb' do |body|