aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/app_rails_loader_test.rb9
-rw-r--r--railties/test/application/initializers/load_path_test.rb1
-rw-r--r--railties/test/application/rake_test.rb17
3 files changed, 20 insertions, 7 deletions
diff --git a/railties/test/app_rails_loader_test.rb b/railties/test/app_rails_loader_test.rb
index a16b8d3302..ceae78ae80 100644
--- a/railties/test/app_rails_loader_test.rb
+++ b/railties/test/app_rails_loader_test.rb
@@ -1,11 +1,10 @@
require 'tmpdir'
-require 'pathname'
require 'abstract_unit'
require 'rails/app_rails_loader'
class AppRailsLoaderTest < ActiveSupport::TestCase
def write(filename, contents=nil)
- FileUtils.mkdir_p(Pathname.new(filename).dirname)
+ FileUtils.mkdir_p(File.dirname(filename))
File.write(filename, contents)
end
@@ -13,10 +12,6 @@ class AppRailsLoaderTest < ActiveSupport::TestCase
Rails::AppRailsLoader.expects(:exec).with(Rails::AppRailsLoader::RUBY, exe)
end
- def realpath(filename)
- Pathname.new(filename).realpath
- end
-
setup do
@tmp = Dir.mktmpdir('railties-rails-loader-test-suite')
@cwd = Dir.pwd
@@ -61,7 +56,7 @@ class AppRailsLoaderTest < ActiveSupport::TestCase
# This happens in particular in Mac OS X, where @tmp starts
# with "/var", and Dir.pwd with "/private/var", due to a
# default system symlink var -> private/var.
- assert_equal realpath("#@tmp/foo"), realpath(Dir.pwd)
+ assert_equal File.realpath("#@tmp/foo"), File.realpath(Dir.pwd)
end
end
end
diff --git a/railties/test/application/initializers/load_path_test.rb b/railties/test/application/initializers/load_path_test.rb
index 9b18c329ec..0c66213caa 100644
--- a/railties/test/application/initializers/load_path_test.rb
+++ b/railties/test/application/initializers/load_path_test.rb
@@ -72,6 +72,7 @@ module ApplicationTests
end
test "load environment with global" do
+ $initialize_test_set_from_env = nil
app_file "config/environments/development.rb", <<-RUBY
$initialize_test_set_from_env = 'success'
AppTemplate::Application.configure do
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index eb590da678..fa3ab969ae 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -79,6 +79,23 @@ module ApplicationTests
assert_match "Hello world", output
end
+ def test_should_not_eager_load_model_path_for_rake
+ add_to_config <<-RUBY
+ config.eager_load = true
+
+ rake_tasks do
+ task do_nothing: :environment do
+ end
+ end
+ RUBY
+
+ app_file "app/models/hello.rb", <<-RUBY
+ raise 'should not be pre-required for rake even `eager_load=true`'
+ RUBY
+
+ Dir.chdir(app_path){ `rake do_nothing` }
+ end
+
def test_code_statistics_sanity
assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0",
Dir.chdir(app_path){ `rake stats` }