Make specs pass on Ruby 1.9.
This commit is contained in:
parent
eeb6a0786a
commit
66d1b968d1
|
@ -214,7 +214,7 @@ module Rails
|
|||
def rake(command, options={})
|
||||
log :rake, command
|
||||
env = options[:env] || 'development'
|
||||
sudo = options[:sudo] && RUBY_PLATFORM !~ /win32|mswin/ ? 'sudo ' : ''
|
||||
sudo = options[:sudo] && RUBY_PLATFORM !~ /mswin|mingw/ ? 'sudo ' : ''
|
||||
in_root { run("#{sudo}#{extify(:rake)} #{command} RAILS_ENV=#{env}", false) }
|
||||
end
|
||||
|
||||
|
@ -268,10 +268,14 @@ module Rails
|
|||
end
|
||||
end
|
||||
|
||||
# Add the ruby command extension to the given name.
|
||||
# Add an extension to the given name based on the platform.
|
||||
#
|
||||
def extify(name)
|
||||
"#{name}#{File.extname(Thor::Util.ruby_command)}"
|
||||
if RUBY_PLATFORM =~ /mswin|mingw/
|
||||
"#{name}.bat"
|
||||
else
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -98,7 +98,10 @@ class ActionsTest < GeneratorsTestCase
|
|||
'# This will be added'
|
||||
end
|
||||
|
||||
assert_file 'config/environment.rb', /# This will be added/
|
||||
assert_file 'config/environment.rb' do |content|
|
||||
assert_match /# This will be added/, content
|
||||
assert_no_match /# This wont be added/, content
|
||||
end
|
||||
end
|
||||
|
||||
def test_git_with_symbol_should_run_command_using_git_scm
|
||||
|
@ -151,34 +154,16 @@ class ActionsTest < GeneratorsTestCase
|
|||
action :rake, 'log:clear', :sudo => true
|
||||
end
|
||||
|
||||
def test_rake_uses_ruby_extension
|
||||
Thor::Util.expects(:ruby_command).returns('ruby.bat')
|
||||
generator.expects(:run).once.with('rake.bat log:clear RAILS_ENV=development', false)
|
||||
action :rake, 'log:clear'
|
||||
end
|
||||
|
||||
def test_capify_should_run_the_capify_command
|
||||
generator.expects(:run).once.with('capify .', false)
|
||||
action :capify!
|
||||
end
|
||||
|
||||
def test_capify_uses_ruby_extension
|
||||
Thor::Util.expects(:ruby_command).returns('ruby.bat')
|
||||
generator.expects(:run).once.with('capify.bat .', false)
|
||||
action :capify!
|
||||
end
|
||||
|
||||
def test_freeze_should_freeze_rails_edge
|
||||
generator.expects(:run).once.with('rake rails:freeze:edge', false)
|
||||
action :freeze!
|
||||
end
|
||||
|
||||
def test_freeze_uses_ruby_extension
|
||||
Thor::Util.expects(:ruby_command).returns('ruby.bat')
|
||||
generator.expects(:run).once.with('rake.bat rails:freeze:edge', false)
|
||||
action :freeze!
|
||||
end
|
||||
|
||||
def test_route_should_add_data_to_the_routes_block_in_config_routes
|
||||
run_generator
|
||||
route_command = "map.route '/login', :controller => 'sessions', :action => 'new'"
|
||||
|
|
|
@ -8,17 +8,23 @@ else
|
|||
RAILS_ROOT = fixtures
|
||||
end
|
||||
|
||||
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../../activerecord/lib"
|
||||
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
|
||||
require 'generators'
|
||||
|
||||
class GeneratorsTestCase < Test::Unit::TestCase
|
||||
include FileUtils
|
||||
|
||||
def self.test_dir
|
||||
@@test_dir = File.expand_path("#{File.dirname(__FILE__)}/../../")
|
||||
end
|
||||
|
||||
def destination_root
|
||||
@destination_root ||= File.expand_path("#{File.dirname(__FILE__)}/../fixtures/tmp")
|
||||
@destination_root ||= File.join(self.class.test_dir, 'fixtures', 'tmp')
|
||||
end
|
||||
|
||||
def setup
|
||||
cd self.class.test_dir
|
||||
rm_rf(destination_root)
|
||||
mkdir_p(destination_root)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue