mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use Rails.root in railties tests
This commit is contained in:
parent
f74e04c21d
commit
01e04a446c
3 changed files with 5 additions and 5 deletions
|
@ -89,7 +89,7 @@ class ActionsTest < GeneratorsTestCase
|
|||
|
||||
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
|
||||
|
|
|
@ -118,7 +118,7 @@ class AppGeneratorTest < GeneratorsTestCase
|
|||
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
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class GeneratorsTest < GeneratorsTestCase
|
|||
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 @@ class GeneratorsTest < GeneratorsTestCase
|
|||
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 @@ class GeneratorsTest < GeneratorsTestCase
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue