aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/date_helper_i18n_test.rb
diff options
context:
space:
mode:
authorChris McGrath <chris@octopod.info>2013-01-17 15:21:26 +0000
committerChris McGrath <chris@octopod.info>2013-01-17 15:21:26 +0000
commit6bb784eab0d286d1966c12e1bacc793113d6fbae (patch)
tree436d9680844b511a16c1ccef6f54671df8f050b3 /actionpack/test/template/date_helper_i18n_test.rb
parent038574a5385e07f1091e355b78558821e123a48c (diff)
downloadrails-6bb784eab0d286d1966c12e1bacc793113d6fbae.tar.gz
rails-6bb784eab0d286d1966c12e1bacc793113d6fbae.tar.bz2
rails-6bb784eab0d286d1966c12e1bacc793113d6fbae.zip
Remove i18n symbol dependency
date.order is the only key in rails i18n that is required to be a symbol. This patch allows for symbols or strings which means: * No requirement for symbol type in .yml files. A future YAML.safe_load wouldn't need to load symbols * Rails could actually use json rather than yml as the backend
Diffstat (limited to 'actionpack/test/template/date_helper_i18n_test.rb')
-rw-r--r--actionpack/test/template/date_helper_i18n_test.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/actionpack/test/template/date_helper_i18n_test.rb b/actionpack/test/template/date_helper_i18n_test.rb
index 495a9d3f9d..21fca35185 100644
--- a/actionpack/test/template/date_helper_i18n_test.rb
+++ b/actionpack/test/template/date_helper_i18n_test.rb
@@ -117,7 +117,7 @@ class DateHelperSelectTagsI18nTests < ActiveSupport::TestCase
I18n.expects(:translate).with(('datetime.prompts.' + key.to_s).to_sym, :locale => 'en').returns prompt
end
- I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns [:year, :month, :day]
+ I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns %w(year month day)
datetime_select('post', 'updated_at', :locale => 'en', :include_seconds => true, :prompt => true)
end
@@ -129,15 +129,20 @@ class DateHelperSelectTagsI18nTests < ActiveSupport::TestCase
end
def test_date_or_time_select_given_no_order_options_translates_order
- I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns [:year, :month, :day]
+ I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns %w(year month day)
datetime_select('post', 'updated_at', :locale => 'en')
end
def test_date_or_time_select_given_invalid_order
- I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns [:invalid, :month, :day]
+ I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns %w(invalid month day)
assert_raise StandardError do
datetime_select('post', 'updated_at', :locale => 'en')
end
end
+
+ def test_date_or_time_select_given_symbol_keys
+ I18n.expects(:translate).with(:'date.order', :locale => 'en', :default => []).returns [:year, :month, :day]
+ datetime_select('post', 'updated_at', :locale => 'en')
+ end
end