mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove unneeded base file
We are only using for one test class
This commit is contained in:
parent
3297909cdc
commit
35867c0bee
2 changed files with 51 additions and 55 deletions
|
@ -1,37 +0,0 @@
|
|||
require 'isolation/abstract_unit'
|
||||
require 'rack/test'
|
||||
require 'env_helpers'
|
||||
|
||||
module ApplicationTests
|
||||
module ConfigurationTests
|
||||
class BaseTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
build_app
|
||||
boot_rails
|
||||
FileUtils.rm_rf("#{app_path}/config/environments")
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_app
|
||||
FileUtils.rm_rf(new_app) if File.directory?(new_app)
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +1,55 @@
|
|||
require 'application/configuration/base_test'
|
||||
require 'isolation/abstract_unit'
|
||||
require 'env_helpers'
|
||||
|
||||
class ApplicationTests::ConfigurationTests::CustomTest < ApplicationTests::ConfigurationTests::BaseTest
|
||||
test 'access custom configuration point' do
|
||||
add_to_config <<-RUBY
|
||||
config.x.payment_processing.schedule = :daily
|
||||
config.x.payment_processing.retries = 3
|
||||
config.x.super_debugger = true
|
||||
config.x.hyper_debugger = false
|
||||
config.x.nil_debugger = nil
|
||||
RUBY
|
||||
require_environment
|
||||
module ApplicationTests
|
||||
module ConfigurationTests
|
||||
class CustomTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
build_app
|
||||
boot_rails
|
||||
FileUtils.rm_rf("#{app_path}/config/environments")
|
||||
end
|
||||
|
||||
x = Rails.configuration.x
|
||||
assert_equal :daily, x.payment_processing.schedule
|
||||
assert_equal 3, x.payment_processing.retries
|
||||
assert_equal true, x.super_debugger
|
||||
assert_equal false, x.hyper_debugger
|
||||
assert_equal nil, x.nil_debugger
|
||||
assert_nil x.i_do_not_exist.zomg
|
||||
def teardown
|
||||
teardown_app
|
||||
FileUtils.rm_rf(new_app) if File.directory?(new_app)
|
||||
end
|
||||
|
||||
test 'access custom configuration point' do
|
||||
add_to_config <<-RUBY
|
||||
config.x.payment_processing.schedule = :daily
|
||||
config.x.payment_processing.retries = 3
|
||||
config.x.super_debugger = true
|
||||
config.x.hyper_debugger = false
|
||||
config.x.nil_debugger = nil
|
||||
RUBY
|
||||
require_environment
|
||||
|
||||
x = Rails.configuration.x
|
||||
assert_equal :daily, x.payment_processing.schedule
|
||||
assert_equal 3, x.payment_processing.retries
|
||||
assert_equal true, x.super_debugger
|
||||
assert_equal false, x.hyper_debugger
|
||||
assert_equal nil, x.nil_debugger
|
||||
assert_nil x.i_do_not_exist.zomg
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue