From d8d83e7821224a762bb215f65002c4afe737a5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 30 Aug 2009 18:49:54 +0200 Subject: Change div.attribute to div.field and add some _form to tests. --- railties/test/generators/scaffold_generator_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/test') diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 05eadd3460..63559a8a01 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -75,6 +75,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase edit new show + _form ).each { |view| assert_file "app/views/product_lines/#{view}.html.erb" } assert_file "app/views/layouts/product_lines.html.erb" -- cgit v1.2.3 From cf4846c6ae991143afaef987a63c3ad9a3a2546b Mon Sep 17 00:00:00 2001 From: Antonio Tapiador del Dujo Date: Tue, 24 Mar 2009 14:49:47 +0100 Subject: I18n support for plugins Rails will now automatically add locale files found in any engine's locale directory to the I18n.load_path (i.e. files that match the glob pattern "config/locales/**/*.{rb,yml}" relative to engine directories). [#2325 state:committed] Signed-off-by: Jeremy Kemper --- .../test/fixtures/plugins/engines/engine/config/locales/en.yml | 2 ++ railties/test/initializer_test.rb | 1 + railties/test/plugin_loader_test.rb | 8 ++++++++ 3 files changed, 11 insertions(+) create mode 100644 railties/test/fixtures/plugins/engines/engine/config/locales/en.yml (limited to 'railties/test') diff --git a/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml b/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml new file mode 100644 index 0000000000..641a7e035c --- /dev/null +++ b/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml @@ -0,0 +1,2 @@ +en: + hello: "Hello from Engine" diff --git a/railties/test/initializer_test.rb b/railties/test/initializer_test.rb index 1fecd62995..5bbd060962 100644 --- a/railties/test/initializer_test.rb +++ b/railties/test/initializer_test.rb @@ -406,6 +406,7 @@ class InitializerSetupI18nTests < Test::Unit::TestCase File.expand_path(File.dirname(__FILE__) + "/../../actionpack/lib/action_view/locale/en.yml"), File.expand_path(File.dirname(__FILE__) + "/../../activemodel/lib/active_model/locale/en.yml"), File.expand_path(File.dirname(__FILE__) + "/../../activerecord/lib/active_record/locale/en.yml"), + File.expand_path(File.dirname(__FILE__) + "/../../railties/test/fixtures/plugins/engines/engine/config/locales/en.yml"), "my/test/locale.yml", "my/other/locale.yml" ], I18n.load_path.collect { |path| path =~ /\.\./ ? File.expand_path(path) : path } end diff --git a/railties/test/plugin_loader_test.rb b/railties/test/plugin_loader_test.rb index 873e000222..99301347b6 100644 --- a/railties/test/plugin_loader_test.rb +++ b/railties/test/plugin_loader_test.rb @@ -156,6 +156,14 @@ class TestPluginLoader < Test::Unit::TestCase plugin_load_paths.each { |path| assert $LOAD_PATH.include?(path) } end + def test_should_add_locale_files_to_I18n_load_path + only_load_the_following_plugins! [:engine] + + @loader.send :add_engine_locales + + assert I18n.load_path.include?(File.join(plugin_fixture_path('engines/engine'), 'config', 'locales', 'en.yml')) + end + private def reset_load_path! -- cgit v1.2.3 From ad49895fe82da5fcad2f401c1238c274e944c062 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 1 Sep 2009 10:05:17 -0500 Subject: Railties test helpers need to activate rack gem --- railties/test/abstract_unit.rb | 5 ++++- railties/test/initializer/test_helper.rb | 3 +++ railties/test/rails_info_test.rb | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 9a640bdbc5..ea6ed01c7d 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -1,5 +1,9 @@ ORIG_ARGV = ARGV.dup +require 'rubygems' +gem 'rack', '~> 1.0.0' +gem 'rack-test', '~> 0.4.2' + $:.unshift File.dirname(__FILE__) + "/../../activesupport/lib" $:.unshift File.dirname(__FILE__) + "/../../activerecord/lib" $:.unshift File.dirname(__FILE__) + "/../../actionpack/lib" @@ -9,7 +13,6 @@ $:.unshift File.dirname(__FILE__) + "/../lib" $:.unshift File.dirname(__FILE__) + "/../builtin/rails_info" require 'stringio' -require 'rubygems' require 'test/unit' require 'active_support' diff --git a/railties/test/initializer/test_helper.rb b/railties/test/initializer/test_helper.rb index 9d7dfff1c0..4cb9c1b814 100644 --- a/railties/test/initializer/test_helper.rb +++ b/railties/test/initializer/test_helper.rb @@ -5,6 +5,9 @@ RAILS_ROOT = File.join(File.dirname(__FILE__), "root") RAILS_FRAMEWORK_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..')) +require 'rubygems' +gem 'rack', '~> 1.0.0' + require "test/unit" # We are purposely avoiding adding things to the load path to catch bugs that only happen in the genuine article require File.join(RAILS_FRAMEWORK_ROOT, 'activesupport', 'lib', 'active_support', 'testing', 'isolation') diff --git a/railties/test/rails_info_test.rb b/railties/test/rails_info_test.rb index fdcc7a1ef6..568e2a9972 100644 --- a/railties/test/rails_info_test.rb +++ b/railties/test/rails_info_test.rb @@ -3,6 +3,9 @@ $:.unshift File.dirname(__FILE__) + "/../builtin/rails_info" $:.unshift File.dirname(__FILE__) + "/../../activesupport/lib" $:.unshift File.dirname(__FILE__) + "/../../actionpack/lib" +require 'rubygems' +gem 'rack', '~> 1.0.0' + require 'test/unit' require 'active_support' require 'active_support/test_case' -- cgit v1.2.3