提交 2d61745a 编写于 作者: A Akira Matsuda

Merge two tests that needs to initialize Rails before accessing `Rails`

Fixes "NameError: uninitialized constant ApplicationTests::ConfigurationTests::CustomTest::Rails"
when run individually
上级 ff7593d6
...@@ -10,7 +10,6 @@ def setup ...@@ -10,7 +10,6 @@ def setup
def teardown def teardown
teardown_app teardown_app
FileUtils.rm_rf(new_app) if File.directory?(new_app)
end end
test "access custom configuration point" do test "access custom configuration point" do
...@@ -30,28 +29,14 @@ def teardown ...@@ -30,28 +29,14 @@ def teardown
assert_equal false, x.hyper_debugger assert_equal false, x.hyper_debugger
assert_nil x.nil_debugger assert_nil x.nil_debugger
assert_nil x.i_do_not_exist.zomg assert_nil x.i_do_not_exist.zomg
end
test "custom configuration responds to all messages" do # test that custom configuration responds to all messages
x = Rails.configuration.x
assert_equal true, x.respond_to?(:i_do_not_exist) assert_equal true, x.respond_to?(:i_do_not_exist)
assert_kind_of Method, x.method(:i_do_not_exist) assert_kind_of Method, x.method(:i_do_not_exist)
assert_kind_of ActiveSupport::OrderedOptions, x.i_do_not_exist assert_kind_of ActiveSupport::OrderedOptions, x.i_do_not_exist
end end
private 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 def require_environment
require "#{app_path}/config/environment" require "#{app_path}/config/environment"
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册