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

@ -10,7 +10,6 @@ def setup
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 @@ def teardown
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