Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge commit 'rails/master'

  • Loading branch information...
commit 792910bb69078ff1d14a6384b50e51aba2aae2dd 2 parents e00c72c + ad4615e
Xavier Noria fxn authored
Showing with 214 additions and 55 deletions.
  1. +2 −0  actionpack/CHANGELOG
  2. +2 −2 actionpack/lib/abstract_controller/assigns.rb
  3. +1 −1  actionpack/lib/abstract_controller/rendering.rb
  4. +3 −2 actionpack/lib/action_controller/caching.rb
  5. +0 −1  actionpack/lib/action_controller/deprecated/base.rb
  6. +1 −0  actionpack/lib/action_dispatch/http/response.rb
  7. +1 −0  actionpack/lib/action_dispatch/middleware/params_parser.rb
  8. +3 −3 actionpack/lib/action_dispatch/routing/mapper.rb
  9. +2 −2 actionpack/lib/action_dispatch/testing/test_process.rb
  10. +1 −1  actionpack/lib/action_view/helpers/cache_helper.rb
  11. +1 −1  actionpack/lib/action_view/helpers/url_helper.rb
  12. +1 −0  actionpack/lib/action_view/test_case.rb
  13. +1 −0  actionpack/test/controller/mime_responds_test.rb
  14. +16 −0 actionpack/test/controller/test_test.rb
  15. +9 −0 actionpack/test/dispatch/routing_test.rb
  16. +2 −2 actionpack/test/template/erb_util_test.rb
  17. +6 −2 actionpack/test/template/url_helper_test.rb
  18. +3 −2 activerecord/lib/rails/generators/active_record.rb
  19. +2 −1  activerecord/test/cases/base_test.rb
  20. +2 −1  activerecord/test/cases/xml_serialization_test.rb
  21. +2 −1  activerecord/test/fixtures/binaries.yml
  22. +7 −1 activesupport/lib/active_support/cache/memory_store.rb
  23. +0 −12 activesupport/lib/active_support/core_ext/benchmark.rb
  24. +0 −7 activesupport/lib/active_support/core_ext/string/multibyte.rb
  25. +35 −0 activesupport/lib/active_support/railtie.rb
  26. +7 −0 activesupport/test/caching_test.rb
  27. +0 −12 activesupport/test/core_ext/string_ext_test.rb
  28. +1 −1  activesupport/test/time_zone_test.rb
  29. +4 −0 railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
  30. +13 −0 railties/test/generators/migration_generator_test.rb
  31. +86 −0 railties/test/railties/i18n_railtie_test.rb
2  actionpack/CHANGELOG
View
@@ -1,5 +1,7 @@
*Rails 3.0.0 [beta 4/release candidate] (unreleased)*
+* Add support for shorthand routes like /projects/status(.:format) #4423 [Diego Carrion]
+
* Changed translate helper so that it doesn’t mark every translation as safe HTML. Only keys with a "_html" suffix and keys named "html" are considered to be safe HTML. All other translations are left untouched. [Craig Davey]
4 actionpack/lib/abstract_controller/assigns.rb
View
@@ -6,7 +6,7 @@ module Assigns
def view_assigns
hash = {}
variables = instance_variable_names
- variables -= config.protected_instance_variables if config.respond_to?(:protected_instance_variables)
+ variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
variables.each { |name| hash[name] = instance_variable_get(name) }
hash
end
@@ -18,4 +18,4 @@ def _evaluate_assigns(object)
view_assigns.each { |k,v| object.instance_variable_set(k, v) }
end
end
-end
+end
2  actionpack/lib/abstract_controller/rendering.rb
View
@@ -126,7 +126,7 @@ def _prefix
def view_assigns
hash = {}
variables = instance_variable_names
- variables -= config.protected_instance_variables if config.respond_to?(:protected_instance_variables)
+ variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
variables.each { |name| hash[name.to_s[1..-1]] = instance_variable_get(name) }
hash
end
5 actionpack/lib/action_controller/caching.rb
View
@@ -63,8 +63,9 @@ def cache_configured?
included do
extend ConfigMethods
- @@perform_caching = true
- cattr_accessor :perform_caching
+ delegate :perform_caching, :perform_caching=, :to => :config
+ singleton_class.delegate :perform_caching, :perform_caching=, :to => :config
+ self.perform_caching = true
end
1  actionpack/lib/action_controller/deprecated/base.rb
View
@@ -154,7 +154,6 @@ def verify(*args)
deprecated_config_accessor :helpers_path
deprecated_config_accessor :javascripts_dir
deprecated_config_accessor :page_cache_directory
- deprecated_config_accessor :protected_instance_variables
deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it"
deprecated_config_accessor :stylesheets_dir
1  actionpack/lib/action_dispatch/http/response.rb
View
@@ -1,6 +1,7 @@
require 'digest/md5'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/object/blank'
+require 'active_support/core_ext/class/attribute_accessors'
module ActionDispatch # :nodoc:
# Represents an HTTP response generated by a controller action. One can use
1  actionpack/lib/action_dispatch/middleware/params_parser.rb
View
@@ -1,3 +1,4 @@
+require 'active_support/core_ext/hash/conversions.rb'
require 'action_dispatch/http/request'
module ActionDispatch
6 actionpack/lib/action_dispatch/routing/mapper.rb
View
@@ -66,8 +66,8 @@ def extract_path_and_options(args)
path = normalize_path(path)
if using_match_shorthand?(path, options)
- options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1')
- options[:as] ||= path[1..-1].gsub("/", "_")
+ options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1').sub(%r{\(.*\)}, '')
+ options[:as] ||= path[1..-1].gsub("/", "_").sub(%r{\(.*\)}, '')
end
[ path, options ]
@@ -80,7 +80,7 @@ def using_to_shorthand?(args, options)
# match "account/overview"
def using_match_shorthand?(path, options)
- path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w\/]+$}
+ path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w+/?]+(\(.*\))*$}
end
def normalize_path(path)
4 actionpack/lib/action_dispatch/testing/test_process.rb
View
@@ -3,13 +3,13 @@
module ActionDispatch
module TestProcess
def assigns(key = nil)
- assigns = {}
+ assigns = {}.with_indifferent_access
@controller.instance_variable_names.each do |ivar|
next if ActionController::Base.protected_instance_variables.include?(ivar)
assigns[ivar[1..-1]] = @controller.instance_variable_get(ivar)
end
- key.nil? ? assigns : assigns[key.to_s]
+ key.nil? ? assigns : assigns[key]
end
def session
2  actionpack/lib/action_view/helpers/cache_helper.rb
View
@@ -39,7 +39,7 @@ def cache(name = {}, options = nil, &block)
private
# TODO: Create an object that has caching read/write on it
def fragment_for(name = {}, options = nil, &block) #:nodoc:
- if controller.class.perform_caching
+ if controller.perform_caching
if controller.fragment_exist?(name, options)
controller.read_fragment(name, options)
else
2  actionpack/lib/action_view/helpers/url_helper.rb
View
@@ -504,7 +504,7 @@ def mail_to(email_address, name = nil, html_options = {})
"document.write('#{content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge({ "href" => "mailto:"+email_address+extras }))}');".each_byte do |c|
string << sprintf("%%%x", c)
end
- "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>"
+ "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>".html_safe
elsif encode == "hex"
email_address_encoded = ''
email_address_obfuscated.each_byte do |c|
1  actionpack/lib/action_view/test_case.rb
View
@@ -1,4 +1,5 @@
require 'active_support/core_ext/object/blank'
+require 'action_controller'
require 'action_controller/test_case'
require 'action_view'
1  actionpack/test/controller/mime_responds_test.rb
View
@@ -1,5 +1,6 @@
require 'abstract_unit'
require 'controller/fake_models'
+require 'active_support/core_ext/hash/conversions'
class RespondToController < ActionController::Base
layout :set_layout
16 actionpack/test/controller/test_test.rb
View
@@ -113,6 +113,11 @@ def delete_cookie
render :nothing => true
end
+ def test_assigns
+ @foo = "foo"
+ render :nothing => true
+ end
+
private
def rescue_action(e)
raise e
@@ -230,6 +235,17 @@ def test_multiple_calls
assert_equal "OK", @response.body
end
+ def test_assigns
+ process :test_assigns
+ # assigns can be accessed using assigns(key)
+ # or assigns[key], where key is a string or
+ # a symbol
+ assert_equal "foo", assigns(:foo)
+ assert_equal "foo", assigns("foo")
+ assert_equal "foo", assigns[:foo]
+ assert_equal "foo", assigns["foo"]
+ end
+
def test_assert_tag_tag
process :test_html_output
9 actionpack/test/dispatch/routing_test.rb
View
@@ -54,6 +54,8 @@ def self.matches?(request)
match "/local/:action", :controller => "local"
+ match "/projects/status(.:format)"
+
constraints(:ip => /192\.168\.1\.\d\d\d/) do
get 'admin' => "queenbee#index"
end
@@ -426,6 +428,13 @@ def test_local
end
end
+ def test_projects_status
+ with_test_routes do
+ assert_equal '/projects/status', url_for(:controller => 'projects', :action => 'status', :only_path => true)
+ assert_equal '/projects/status.json', url_for(:controller => 'projects', :action => 'status', :format => 'json', :only_path => true)
+ end
+ end
+
def test_projects
with_test_routes do
get '/projects'
4 actionpack/test/template/erb_util_test.rb
View
@@ -4,12 +4,12 @@ class ErbUtilTest < Test::Unit::TestCase
include ERB::Util
ERB::Util::HTML_ESCAPE.each do |given, expected|
- define_method "test_html_escape_#{expected.gsub /\W/, ''}" do
+ define_method "test_html_escape_#{expected.gsub(/\W/, '')}" do
assert_equal expected, html_escape(given)
end
unless given == '"'
- define_method "test_json_escape_#{expected.gsub /\W/, ''}" do
+ define_method "test_json_escape_#{expected.gsub(/\W/, '')}" do
assert_equal ERB::Util::JSON_ESCAPE[given], json_escape(given)
end
end
8 actionpack/test/template/url_helper_test.rb
View
@@ -356,11 +356,15 @@ def test_mail_to
end
def test_mail_to_with_javascript
- assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", "My email", :encode => "javascript")
+ snippet = mail_to("me@domain.com", "My email", :encode => "javascript")
+ assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", snippet
+ assert snippet.html_safe?
end
def test_mail_to_with_javascript_unicode
- assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%75%6e%69%63%6f%64%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%3e%c3%ba%6e%69%63%6f%64%65%3c%2f%61%3e%27%29%3b'))</script>", mail_to("unicode@example.com", "únicode", :encode => "javascript")
+ snippet = mail_to("unicode@example.com", "únicode", :encode => "javascript")
+ assert_dom_equal "<script type=\"text/javascript\">eval(decodeURIComponent('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%75%6e%69%63%6f%64%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%3e%c3%ba%6e%69%63%6f%64%65%3c%2f%61%3e%27%29%3b'))</script>", snippet
+ assert snippet.html_safe
end
def test_mail_with_options
5 activerecord/lib/rails/generators/active_record.rb
View
@@ -19,10 +19,11 @@ def self.source_root
# Implement the required interface for Rails::Generators::Migration.
#
def self.next_migration_number(dirname) #:nodoc:
+ next_migration_number = current_migration_number(dirname) + 1
if ActiveRecord::Base.timestamped_migrations
- Time.now.utc.strftime("%Y%m%d%H%M%S")
+ [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
else
- "%.3d" % (current_migration_number(dirname) + 1)
+ "%.3d" % next_migration_number
end
end
end
3  activerecord/test/cases/base_test.rb
View
@@ -2095,7 +2095,8 @@ def test_to_xml
assert_equal written_on_in_current_timezone, xml.elements["//written-on"].text
assert_equal "datetime" , xml.elements["//written-on"].attributes['type']
- assert_equal "--- Have a nice day\n" , xml.elements["//content"].text
+ assert_match(/^--- Have a nice day\n/ , xml.elements["//content"].text)
+ assert_equal 'Have a nice day' , YAML.load(xml.elements["//content"].text)
assert_equal "yaml" , xml.elements["//content"].attributes['type']
assert_equal "david@loudthinking.com", xml.elements["//author-email-address"].text
3  activerecord/test/cases/xml_serialization_test.rb
View
@@ -4,6 +4,7 @@
require 'models/author'
require 'models/tagging'
require 'models/comment'
+require 'models/company_in_module'
class XmlSerializationTest < ActiveRecord::TestCase
def test_should_serialize_default_root
@@ -79,7 +80,7 @@ def test_should_serialize_boolean
end
def test_should_serialize_yaml
- assert_match %r{<preferences type=\"yaml\">--- \n:gem: ruby\n</preferences>}, @xml
+ assert_match %r{<preferences type=\"yaml\">---\s?\n:gem: ruby\n</preferences>}, @xml
end
end
3  activerecord/test/fixtures/binaries.yml
View
@@ -1,6 +1,7 @@
flowers:
id: 1
- data: !binary | /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCQoKCg4LCw4UDQsNFBcRDg4R
+ data: !binary |-
+ /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCQoKCg4LCw4UDQsNFBcRDg4R
FxsVFRUVFRsbFRcXFxcVGxoeICEgHhonJyoqJyc1NTU1NTY2NjY2NjY2Njb/
2wBDAQ4NDRERERcRERcXExQTFx0ZGhoZHSYdHR4dHSYsJCAgICAkLCgrJiYm
KygvLywsLy82NjY2NjY2NjY2NjY2Njb/wAARCACvAIMDAREAAhEBAxEB/8QA
8 activesupport/lib/active_support/cache/memory_store.rb
View
@@ -21,6 +21,12 @@ def initialize
@data = {}
end
+ def read_multi(*names)
+ results = {}
+ names.each { |n| results[n] = read(n) }
+ results
+ end
+
def read(name, options = nil)
super do
@data[name]
@@ -45,7 +51,7 @@ def delete_matched(matcher, options = nil)
end
end
- def exist?(name,options = nil)
+ def exist?(name, options = nil)
super do
@data.has_key?(name)
end
12 activesupport/lib/active_support/core_ext/benchmark.rb
View
@@ -1,18 +1,6 @@
require 'benchmark'
class << Benchmark
- # Earlier Ruby had a slower implementation.
- if RUBY_VERSION < '1.8.7'
- remove_method :realtime
-
- def realtime
- r0 = Time.now
- yield
- r1 = Time.now
- r1.to_f - r0.to_f
- end
- end
-
def ms
1000 * realtime { yield }
end
7 activesupport/lib/active_support/core_ext/string/multibyte.rb
View
@@ -49,13 +49,6 @@ def mb_chars
def is_utf8?
ActiveSupport::Multibyte::Chars.consumes?(self)
end
-
- unless '1.8.7 and later'.respond_to?(:chars)
- def chars
- ActiveSupport::Deprecation.warn('String#chars has been deprecated in favor of String#mb_chars.', caller)
- mb_chars
- end
- end
else
def mb_chars #:nodoc
self
35 activesupport/lib/active_support/railtie.rb
View
@@ -33,6 +33,7 @@ class Railtie < Rails::Railtie
config.i18n = ActiveSupport::OrderedOptions.new
config.i18n.railties_load_path = []
config.i18n.load_path = []
+ config.i18n.fallbacks = ActiveSupport::OrderedOptions.new
initializer "i18n.initialize" do
ActiveSupport.on_load(:i18n) do
@@ -53,6 +54,8 @@ class Railtie < Rails::Railtie
app.config.i18n.load_path.unshift(*value)
when :load_path
I18n.load_path += value
+ when :fallbacks
+ init_fallbacks(value) if value && validate_fallbacks(value)
else
I18n.send("#{setting}=", value)
end
@@ -60,5 +63,37 @@ class Railtie < Rails::Railtie
I18n.reload!
end
+
+ class << self
+ protected
+
+ def init_fallbacks(fallbacks)
+ include_fallbacks_module
+ args = case fallbacks
+ when ActiveSupport::OrderedOptions
+ [*(fallbacks[:defaults] || []) << fallbacks[:map]].compact
+ when Hash, Array
+ Array.wrap(fallbacks)
+ else # TrueClass
+ []
+ end
+ I18n.fallbacks = I18n::Locale::Fallbacks.new(*args)
+ end
+
+ def include_fallbacks_module
+ I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
+ end
+
+ def validate_fallbacks(fallbacks)
+ case fallbacks
+ when ActiveSupport::OrderedOptions
+ !fallbacks.empty?
+ when TrueClass, Array, Hash
+ true
+ else
+ raise "Unexpected fallback type #{fallbacks.inspect}"
+ end
+ end
+ end
end
end
7 activesupport/test/caching_test.rb
View
@@ -185,6 +185,13 @@ def test_original_store_objects_should_not_be_immutable
@cache.write('foo', bar)
assert_nothing_raised { bar.gsub!(/.*/, 'baz') }
end
+
+ def test_multi_get
+ @cache.write('foo', 1)
+ @cache.write('goo', 2)
+ result = @cache.read_multi('foo', 'goo')
+ assert_equal({'foo' => 1, 'goo' => 2}, result)
+ end
end
uses_memcached 'memcached backed store' do
12 activesupport/test/core_ext/string_ext_test.rb
View
@@ -230,18 +230,6 @@ def test_string_should_recognize_utf8_strings
assert !BYTE_STRING.is_utf8?
end
- if RUBY_VERSION < '1.8.7'
- def test_core_ext_adds_chars
- assert UNICODE_STRING.respond_to?(:chars)
- end
-
- def test_chars_warns_about_deprecation
- assert_deprecated("String#chars") do
- ''.chars
- end
- end
- end
-
if RUBY_VERSION < '1.9'
def test_mb_chars_returns_self_when_kcode_not_set
with_kcode('none') do
2  activesupport/test/time_zone_test.rb
View
@@ -282,7 +282,7 @@ def test_unknown_zone_shouldnt_have_tzinfo_nor_utc_offset
def test_unknown_zone_with_utc_offset
zone = ActiveSupport::TimeZone.create("bogus", -21_600)
- assert_equal -21_600, zone.utc_offset
+ assert_equal(-21_600, zone.utc_offset)
end
def test_new
4 railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
View
@@ -39,4 +39,8 @@
# Enable threaded mode
# config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
end
13 railties/test/generators/migration_generator_test.rb
View
@@ -10,6 +10,19 @@ def test_migration
assert_migration "db/migrate/#{migration}.rb", /class ChangeTitleBodyFromPosts < ActiveRecord::Migration/
end
+ def test_migrations_generated_simultaneously
+ migrations = ["change_title_body_from_posts", "change_email_from_comments"]
+
+ first_migration_number, second_migration_number = migrations.collect do |migration|
+ run_generator [migration]
+ file_name = migration_file_name "db/migrate/#{migration}.rb"
+
+ File.basename(file_name).split('_').first
+ end
+
+ assert_not_equal first_migration_number, second_migration_number
+ end
+
def test_migration_with_class_name
migration = "ChangeTitleBodyFromPosts"
run_generator [migration]
86 railties/test/railties/i18n_railtie_test.rb
View
@@ -0,0 +1,86 @@
+require "isolation/abstract_unit"
+
+module RailtiesTest
+ class I18nRailtieTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
+
+ def setup
+ build_app
+ boot_rails
+ FileUtils.rm_rf("#{app_path}/config/environments")
+ require "rails/all"
+ @old_path = I18n.load_path
+ end
+
+ def teardown
+ I18n.load_path = @old_path || []
+ I18n.backend = nil
+ end
+
+ def load_app
+ require "#{app_path}/config/environment"
+ end
+
+ def assert_fallbacks(fallbacks)
+ fallbacks.each do |locale, expected|
+ actual = I18n.fallbacks[locale]
+ assert_equal expected, actual, "expected fallbacks for #{locale.inspect} to be #{expected.inspect}, but were #{actual.inspect}"
+ end
+ end
+
+ def assert_no_fallbacks
+ assert !I18n.backend.class.included_modules.include?(I18n::Backend::Fallbacks)
+ end
+
+ test "config.i18n.load_path gets added to I18n.load_path" do
+ I18n.load_path = ['existing/path/to/locales']
+ I18n::Railtie.config.i18n.load_path = ['new/path/to/locales']
+ load_app
+
+ assert I18n.load_path.include?('existing/path/to/locales')
+ assert I18n.load_path.include?('new/path/to/locales')
+ end
+
+ test "not using config.i18n.fallbacks does not initialize I18n.fallbacks" do
+ I18n.backend = Class.new { include I18n::Backend::Base }.new # can't uninclude modules, so use a tmp backend class
+ load_app
+ assert_no_fallbacks
+ end
+
+ test "config.i18n.fallbacks = true initializes I18n.fallbacks with default settings" do
+ I18n::Railtie.config.i18n.fallbacks = true
+ load_app
+ assert_fallbacks :de => [:de, :en]
+ end
+
+ test "config.i18n.fallbacks.defaults = [:'en-US'] initializes fallbacks with en-US as a fallback default" do
+ I18n::Railtie.config.i18n.fallbacks.defaults = [:'en-US']
+ load_app
+ assert_fallbacks :de => [:de, :'en-US', :en]
+ end
+
+ test "config.i18n.fallbacks.map = { :ca => :'es-ES' } initializes fallbacks with a mapping ca => es-ES" do
+ I18n::Railtie.config.i18n.fallbacks.map = { :ca => :'es-ES' }
+ load_app
+ assert_fallbacks :ca => [:ca, :"es-ES", :es, :en]
+ end
+
+ test "[shortcut] config.i18n.fallbacks = [:'en-US'] initializes fallbacks with en-US as a fallback default" do
+ I18n::Railtie.config.i18n.fallbacks = [:'en-US']
+ load_app
+ assert_fallbacks :de => [:de, :'en-US', :en]
+ end
+
+ test "[shortcut] config.i18n.fallbacks = [{ :ca => :'es-ES' }] initializes fallbacks with a mapping de-AT => de-DE" do
+ I18n::Railtie.config.i18n.fallbacks.map = { :ca => :'es-ES' }
+ load_app
+ assert_fallbacks :ca => [:ca, :"es-ES", :es, :en]
+ end
+
+ test "[shortcut] config.i18n.fallbacks = [:'en-US', { :ca => :'es-ES' }] initializes fallbacks with the given arguments" do
+ I18n::Railtie.config.i18n.fallbacks = [:'en-US', { :ca => :'es-ES' }]
+ load_app
+ assert_fallbacks :ca => [:ca, :"es-ES", :es, :'en-US', :en]
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.