diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-19 19:41:15 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-19 19:41:15 -0300 |
commit | 43073b393d234acd094ac7c220163f4e419d11f5 (patch) | |
tree | 0d78982dfb1b93f929cc186c951f775a494af621 /railties/test | |
parent | 867631f9cfa6d639baacc09aac76e68819d5501f (diff) | |
download | rails-43073b393d234acd094ac7c220163f4e419d11f5.tar.gz rails-43073b393d234acd094ac7c220163f4e419d11f5.tar.bz2 rails-43073b393d234acd094ac7c220163f4e419d11f5.zip |
Revert "Improve custom configuration"
This reverts commit de4891344ccc074f6d5693f4fac6ad610584e336.
Conflicts:
railties/lib/rails/railtie/configuration.rb
It added regression. Will be back after the beta
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/configuration/base_test.rb | 6 | ||||
-rw-r--r-- | railties/test/application/configuration/custom_test.rb | 81 | ||||
-rw-r--r-- | railties/test/railties/engine_test.rb | 2 |
3 files changed, 9 insertions, 80 deletions
diff --git a/railties/test/application/configuration/base_test.rb b/railties/test/application/configuration/base_test.rb index 6e2b618160..d6a82b139d 100644 --- a/railties/test/application/configuration/base_test.rb +++ b/railties/test/application/configuration/base_test.rb @@ -5,8 +5,6 @@ require 'env_helpers' module ApplicationTests module ConfigurationTests class BaseTest < ActiveSupport::TestCase - include ActiveSupport::Testing::Isolation - def setup build_app boot_rails @@ -32,8 +30,8 @@ module ApplicationTests end def require_environment - require "#{app_path}/config/environment" + require "#{app_path}/config/environment" end end end -end +end
\ No newline at end of file diff --git a/railties/test/application/configuration/custom_test.rb b/railties/test/application/configuration/custom_test.rb index e8c7a37913..045537fc28 100644 --- a/railties/test/application/configuration/custom_test.rb +++ b/railties/test/application/configuration/custom_test.rb @@ -1,84 +1,15 @@ require 'application/configuration/base_test' class ApplicationTests::ConfigurationTests::CustomTest < ApplicationTests::ConfigurationTests::BaseTest - test 'configuration top level can be chained' do + test 'access custom configuration point' do add_to_config <<-RUBY - config.resque.inline_jobs = :always - config.resque.timeout = 60 + config.x.resque.inline_jobs = :always + config.x.resque.timeout = 60 RUBY require_environment - assert_equal :always, Rails.configuration.resque.inline_jobs - assert_equal 60, Rails.configuration.resque.timeout - assert_nil Rails.configuration.resque.nothing - end - - test 'configuration top level accept normal values' do - add_to_config <<-RUBY - config.timeout = 60 - config.something_nil = nil - config.something_false = false - config.something_true = true - RUBY - require_environment - - assert_equal 60, Rails.configuration.timeout - assert_equal nil, Rails.configuration.something_nil - assert_equal false, Rails.configuration.something_false - assert_equal true, Rails.configuration.something_true - end - - test 'configuration top level builds options from hashes' do - add_to_config <<-RUBY - config.resque = { timeout: 60, inline_jobs: :always } - RUBY - require_environment - - assert_equal :always, Rails.configuration.resque.inline_jobs - assert_equal 60, Rails.configuration.resque.timeout - assert_nil Rails.configuration.resque.nothing - end - - test 'configuration top level builds options from hashes with string keys' do - add_to_config <<-RUBY - config.resque = { 'timeout' => 60, 'inline_jobs' => :always } - RUBY - require_environment - - assert_equal :always, Rails.configuration.resque.inline_jobs - assert_equal 60, Rails.configuration.resque.timeout - assert_nil Rails.configuration.resque.nothing - end - - test 'configuration top level builds nested options from hashes with symbol keys' do - add_to_config <<-RUBY - config.resque = { timeout: 60, inline_jobs: :always, url: { host: 'localhost', port: 8080 } } - config.resque.url.protocol = 'https' - config.resque.queues = { production: ['low_priority'] } - RUBY - require_environment - - assert_equal(:always, Rails.configuration.resque.inline_jobs) - assert_equal(60, Rails.configuration.resque.timeout) - assert_equal({ host: 'localhost', port: 8080, protocol: 'https' }, Rails.configuration.resque.url) - assert_equal('localhost', Rails.configuration.resque.url.host) - assert_equal(8080, Rails.configuration.resque.url.port) - assert_equal('https', Rails.configuration.resque.url.protocol) - assert_equal(['low_priority'], Rails.configuration.resque.queues.production) - assert_nil(Rails.configuration.resque.nothing) - end - - test 'configuration top level builds nested options from hashes with string keys' do - add_to_config <<-RUBY - config.resque = { 'timeout' => 60, 'inline_jobs' => :always, 'url' => { 'host' => 'localhost', 'port' => 8080 } } - RUBY - require_environment - - assert_equal(:always, Rails.configuration.resque.inline_jobs) - assert_equal(60, Rails.configuration.resque.timeout) - assert_equal({ host: 'localhost', port: 8080 }, Rails.configuration.resque.url) - assert_equal('localhost', Rails.configuration.resque.url.host) - assert_equal(8080, Rails.configuration.resque.url.port) - assert_nil(Rails.configuration.resque.nothing) + assert_equal :always, Rails.configuration.x.resque.inline_jobs + assert_equal 60, Rails.configuration.x.resque.timeout + assert_nil Rails.configuration.x.resque.nothing end end diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index da4eccd2b7..ec64ce5941 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -840,7 +840,7 @@ YAML Rails.application.load_seed assert Rails.application.config.app_seeds_loaded - assert_empty Bukkits::Engine.config.bukkits_seeds_loaded + assert_raise(NoMethodError) { Bukkits::Engine.config.bukkits_seeds_loaded } Bukkits::Engine.load_seed assert Bukkits::Engine.config.bukkits_seeds_loaded |