diff options
| author | hukl <contact@smyck.org> | 2010-01-14 22:21:43 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2010-01-14 22:21:43 +0100 |
| commit | 57d1382013c85a7b11ac8ce5e683f6006b12b328 (patch) | |
| tree | 19646c4fa5952fa1cf0a2c874952affa346373f1 /vendor/plugins/globalize2/test/load_path_test.rb | |
| parent | 1b86bf5f2e35d1820bfa32d979bcc2d9ff9a9a8e (diff) | |
Updated globalize2 to latest version. Modified existing code accoringly
Diffstat (limited to 'vendor/plugins/globalize2/test/load_path_test.rb')
| -rw-r--r-- | vendor/plugins/globalize2/test/load_path_test.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/vendor/plugins/globalize2/test/load_path_test.rb b/vendor/plugins/globalize2/test/load_path_test.rb deleted file mode 100644 index ff009b3..0000000 --- a/vendor/plugins/globalize2/test/load_path_test.rb +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | require File.join( File.dirname(__FILE__), 'test_helper' ) | ||
| 2 | require 'globalize/load_path' | ||
| 3 | |||
| 4 | class LoadPathTest < ActiveSupport::TestCase | ||
| 5 | def setup | ||
| 6 | @plugin_dir = "#{File.dirname(__FILE__)}/.." | ||
| 7 | @locale_dir = "#{File.dirname(__FILE__)}/data/locale" | ||
| 8 | @load_path = Globalize::LoadPath.new | ||
| 9 | end | ||
| 10 | |||
| 11 | test "returns glob patterns for all locales and ruby + yaml files by default" do | ||
| 12 | patterns = %w(locales/all.rb | ||
| 13 | locales/*.rb | ||
| 14 | locales/*/**/*.rb | ||
| 15 | locales/all.yml | ||
| 16 | locales/*.yml | ||
| 17 | locales/*/**/*.yml) | ||
| 18 | assert_equal patterns, @load_path.send(:patterns, 'locales') | ||
| 19 | end | ||
| 20 | |||
| 21 | test "returns the glob patterns for registered locales and extensions" do | ||
| 22 | @load_path.locales = [:en, :de] | ||
| 23 | @load_path.extensions = [:sql] | ||
| 24 | patterns = %w(locales/all.sql | ||
| 25 | locales/en.sql | ||
| 26 | locales/en/**/*.sql | ||
| 27 | locales/de.sql | ||
| 28 | locales/de/**/*.sql) | ||
| 29 | assert_equal patterns, @load_path.send(:patterns, 'locales') | ||
| 30 | end | ||
| 31 | |||
| 32 | test "expands paths using yml as a default file extension" do | ||
| 33 | @load_path << @locale_dir | ||
| 34 | expected = %w(all.yml de-DE.yml en-US.yml en-US/module.yml fi-FI/module.yml root.yml) | ||
| 35 | assert_equal expected, @load_path.map{|path| path.sub("#{@locale_dir}\/", '')} | ||
| 36 | end | ||
| 37 | |||
| 38 | test "appends new paths to the collection so earlier collected paths preceed later collected ones" do | ||
| 39 | @load_path.locales = [:root] | ||
| 40 | @load_path << "#{@plugin_dir}/lib/locale" | ||
| 41 | @load_path << @locale_dir | ||
| 42 | |||
| 43 | expected = %W(#{@plugin_dir}/lib/locale/root.yml | ||
| 44 | #{@locale_dir}/all.yml | ||
| 45 | #{@locale_dir}/root.yml) | ||
| 46 | assert_equal expected, @load_path | ||
| 47 | end | ||
| 48 | |||
| 49 | end | ||
