diff options
author | gregolsen <anotheroneman@yahoo.com> | 2012-09-18 17:18:19 +0300 |
---|---|---|
committer | gregolsen <anotheroneman@yahoo.com> | 2012-09-18 17:18:19 +0300 |
commit | da26dfbefdccac4ab1f3195ae747685d2b11be13 (patch) | |
tree | b70490470cd80389bdaf19ab96af2948544507a9 /railties | |
parent | 9f2d1a146c3883c2ea9d16d4fa5a7ad65ca55db8 (diff) | |
download | rails-da26dfbefdccac4ab1f3195ae747685d2b11be13.tar.gz rails-da26dfbefdccac4ab1f3195ae747685d2b11be13.tar.bz2 rails-da26dfbefdccac4ab1f3195ae747685d2b11be13.zip |
Date.beginning_of_week thread local and beginning_of_week application config option added (default is Monday)
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 3 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 22 |
2 files changed, 24 insertions, 1 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index c4c1fcca40..580d7c6c77 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -13,7 +13,7 @@ module Rails :railties_order, :relative_url_root, :secret_token, :serve_static_assets, :ssl_options, :static_cache_control, :session_options, :time_zone, :reload_classes_only_on_change, - :queue, :queue_consumer + :queue, :queue_consumer, :beginning_of_week attr_writer :log_level attr_reader :encoding @@ -31,6 +31,7 @@ module Rails @session_store = :cookie_store @session_options = {} @time_zone = "UTC" + @beginning_of_week = :monday @log_level = nil @middleware = app_middleware @generators = app_generators diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 039b08c723..428c90afd0 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -445,6 +445,28 @@ module ApplicationTests end end + test "valid beginning of week is setup correctly" do + add_to_config <<-RUBY + config.root = "#{app_path}" + config.beginning_of_week = :wednesday + RUBY + + require "#{app_path}/config/environment" + + assert_equal :wednesday, Rails.application.config.beginning_of_week + end + + test "raises when an invalid beginning of week is defined in the config" do + add_to_config <<-RUBY + config.root = "#{app_path}" + config.beginning_of_week = :invalid + RUBY + + assert_raise(ArgumentError) do + require "#{app_path}/config/environment" + end + end + test "config.action_controller.perform_caching = false" do make_basic_app do |app| app.config.action_controller.perform_caching = false |