Merge pull request #390 from bhollis/i18n

Fix I18n tests by clearing out locale paths from other test runs
This commit is contained in:
Thomas Reynolds 2012-04-25 22:42:55 -07:00
commit 9a7fd0f8d4
4 changed files with 9 additions and 8 deletions

View file

@ -17,10 +17,6 @@ module Middleman::CoreExtensions::DefaultHelpers
# app.helpers ::Padrino::Helpers::TranslationHelpers
app.helpers Helpers
app.ready do
::I18n.load_path += Dir["#{File.dirname(__FILE__)}/../vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/*.yml"]
end
end
alias :included :registered
end

View file

@ -12,7 +12,12 @@ module Middleman::CoreExtensions::I18n
# Needed for helpers as well
app.after_configuration do
::I18n.load_path += [Dir[File.join(root, locales_dir, "*.yml")]]
# This is for making the tests work - since the tests
# don't completely reload middleman, I18n.load_path can get
# polluted with paths from other test app directories that don't
# exist anymore.
::I18n.load_path.delete_if {|path| path =~ %r{tmp/aruba}}
::I18n.load_path += Dir[File.join(root, locales_dir, "*.yml")]
::I18n.reload!
end
end

View file

@ -191,7 +191,7 @@ end
##
# Loads our locale configuration files
#
### I18n.load_path += Dir["#{File.dirname(__FILE__)}/locale/*.yml"] if defined?(I18n) ### !!! FIXME middleman ###
I18n.load_path += Dir["#{File.dirname(__FILE__)}/locale/*.yml"] if defined?(I18n)
##
# Used to determine if this file has already been required

View file

@ -1,7 +1,7 @@
require 'middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite' unless defined?(SupportLite) ### !!! FIXME middleman ###
### require 'padrino-core/support_lite' unless defined?(SupportLite) ### !!! FIXME middleman ###
require 'cgi'
### require 'i18n' ### !!! FIXME middleman ###
require 'i18n'
require 'enumerator'
require 'active_support/core_ext/string/conversions' # to_date
require 'active_support/core_ext/float/rounding' # round
@ -12,7 +12,7 @@ require 'active_support/inflector' # humanize
FileSet.glob_require('padrino-helpers/**/*.rb', __FILE__)
# Load our locales
### I18n.load_path += Dir["#{File.dirname(__FILE__)}/padrino-helpers/locale/*.yml"] ### !!! FIXME middleman ###
I18n.load_path += Dir["#{File.dirname(__FILE__)}/padrino-helpers/locale/*.yml"]
module Padrino
##