Permalink
Browse files

Use Rails.root in railties tests

  • Loading branch information...
1 parent f74e04c commit 01e04a446c801af88a1bb0315efffc775a00eedf @josh josh committed Oct 18, 2009
View
2 railties/test/generators/actions_test.rb
@@ -89,7 +89,7 @@ def test_gem_with_lib_option_set_to_false_should_put_gem_dependency_in_enviromen
def test_environment_should_include_data_in_environment_initializer_block
run_generator
- load_paths = 'config.load_paths += %w["#{RAILS_ROOT}/app/extras"]'
+ load_paths = 'config.load_paths += %w["#{Rails.root}/app/extras"]'
action :environment, load_paths
assert_file 'config/application.rb', /#{Regexp.escape(load_paths)}/
end
View
2 railties/test/generators/app_generator_test.rb
@@ -118,7 +118,7 @@ def test_rails_is_frozen
end
def test_template_from_dir_pwd
- FileUtils.cd(RAILS_ROOT)
+ FileUtils.cd(Rails.root)
assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"])
end
View
6 railties/test/generators_test.rb
@@ -80,7 +80,7 @@ def test_find_by_namespace_lookup_with_gem_specification
Rails::Generators.instance_variable_set(:@load_paths, nil)
spec = Gem::Specification.new
- spec.expects(:full_gem_path).returns(File.join(RAILS_ROOT, 'vendor', 'another_gem_path', 'xspec'))
+ spec.expects(:full_gem_path).returns(File.join(Rails.root, 'vendor', 'another_gem_path', 'xspec'))
Gem.expects(:respond_to?).with(:loaded_specs).returns(true)
Gem.expects(:loaded_specs).returns(:spec => spec)
@@ -119,7 +119,7 @@ def test_no_color_sets_proper_shell
end
def test_rails_root_templates
- template = File.join(RAILS_ROOT, "lib", "templates", "active_record", "model", "model.rb")
+ template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb")
# Create template
mkdir_p(File.dirname(template))
@@ -171,6 +171,6 @@ def self.name
def test_source_paths_for_not_namespaced_generators
mspec = Rails::Generators.find_by_namespace :mspec
- assert mspec.source_paths.include?(File.join(RAILS_ROOT, "lib", "templates", "mspec"))
+ assert mspec.source_paths.include?(File.join(Rails.root, "lib", "templates", "mspec"))
end
end

0 comments on commit 01e04a4

Please sign in to comment.