Skip to content

Commit

Permalink
Merge two tests that needs to initialize Rails before accessing Rails
Browse files Browse the repository at this point in the history
Fixes "NameError: uninitialized constant ApplicationTests::ConfigurationTests::CustomTest::Rails"
when run individually
  • Loading branch information
amatsuda committed Jan 22, 2017
1 parent ff7593d commit 2d61745
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions railties/test/application/configuration/custom_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2d61745

Please sign in to comment.