From da26dfbefdccac4ab1f3195ae747685d2b11be13 Mon Sep 17 00:00:00 2001 From: gregolsen Date: Tue, 18 Sep 2012 17:18:19 +0300 Subject: Date.beginning_of_week thread local and beginning_of_week application config option added (default is Monday) --- railties/lib/rails/application/configuration.rb | 3 ++- railties/test/application/configuration_test.rb | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'railties') 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 -- cgit v1.2.3