1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge two tests that needs to initialize Rails before accessing Rails

Fixes "NameError: uninitialized constant ApplicationTests::ConfigurationTests::CustomTest::Rails"
when run individually
This commit is contained in:
Akira Matsuda 2017-01-19 16:33:30 +09:00
parent ff7593d63e
commit 2d61745af4

View file

@ -10,7 +10,6 @@ module ApplicationTests
def teardown
teardown_app
FileUtils.rm_rf(new_app) if File.directory?(new_app)
end
test "access custom configuration point" do
@ -30,28 +29,14 @@ module ApplicationTests
assert_equal false, x.hyper_debugger
assert_nil x.nil_debugger
assert_nil x.i_do_not_exist.zomg
end
test "custom configuration responds to all messages" do
x = Rails.configuration.x
# test that custom configuration responds to all messages
assert_equal true, x.respond_to?(:i_do_not_exist)
assert_kind_of Method, x.method(:i_do_not_exist)
assert_kind_of ActiveSupport::OrderedOptions, x.i_do_not_exist
end
private
def new_app
File.expand_path("#{app_path}/../new_app")
end
def copy_app
FileUtils.cp_r(app_path, new_app)
end
def app
@app ||= Rails.application
end
def require_environment
require "#{app_path}/config/environment"
end