summaryrefslogtreecommitdiffstats
path: root/vendor/plugins/engines/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-09-13 17:14:35 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-09-13 17:14:35 +0000
commit7b0cb6aba8715aff00519f200060fbf46ae9bb97 (patch)
treec4dc3bcac1a48020c2afef87094056a9a5e06b6f /vendor/plugins/engines/test
parentfb349dc4abe283481984c67cd1287312f128dbfc (diff)
downloadredmine-7b0cb6aba8715aff00519f200060fbf46ae9bb97.tar.gz
redmine-7b0cb6aba8715aff00519f200060fbf46ae9bb97.zip
Upgraded to Rails 2.3.4 (#3597)
* Ran the Rails upgrade * Upgraded to Rails Engines 2.3.2 * Added a plugin to let Engines override application views. * Converted tests to use the new classes: ** ActionController::TestCase for functional ** ActiveSupport::TestCase for units * Converted ActiveRecord::Error message to a string. * ActiveRecord grouping returns an ordered hash which doesn't have #sort! * Updated the I18n storage_units format. * Added some default initializers from a fresh rails app * Changed the order of check_box_tags and hidden_field_tags. The hidden tag needs to appear first in Rails 2.3, otherwise it will override any value in the check_box_tag. * Removed the custom handler for when the cookie store is tampered with. Rails 2.3 removed the TamperedWithCookie exception and instead Rails will not load the data from it when it's been tampered with (e.g. no user login). * Fixed mail layouts, 2.3 has problems with implicit multipart emails that use layouts. Also removed some custom Redmine mailer code. * Fixed a bug that occurred in tests where the "required" span tag would be added to the :field_status translation. This resulted in an email string of: <li>Status<span class="required"> *</span><span class="required"> *</span> Instead of: <li>Status: New</li> git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2887 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor/plugins/engines/test')
-rw-r--r--vendor/plugins/engines/test/app/controllers/app_and_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/app/controllers/namespace/app_and_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/app/helpers/mail_helper.rb5
-rw-r--r--vendor/plugins/engines/test/app/models/app_and_plugin_model.rb3
-rw-r--r--vendor/plugins/engines/test/app/models/notify_mail.rb26
-rw-r--r--vendor/plugins/engines/test/app/things/thing.rb3
-rw-r--r--vendor/plugins/engines/test/app/views/app_and_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/namespace/app_and_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.html.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.plain.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/notify_mail/multipart_html.html.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/notify_mail/multipart_plain.html.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/notify_mail/signup.text.plain.erb5
-rw-r--r--vendor/plugins/engines/test/app/views/plugin_mail/mail_from_plugin_with_application_template.text.plain.erb1
-rw-r--r--vendor/plugins/engines/test/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb1
-rw-r--r--vendor/plugins/engines/test/functional/controller_loading_test.rb51
-rw-r--r--vendor/plugins/engines/test/functional/exception_notification_compatibility_test.rb29
-rw-r--r--vendor/plugins/engines/test/functional/locale_loading_test.rb26
-rw-r--r--vendor/plugins/engines/test/functional/routes_test.rb29
-rw-r--r--vendor/plugins/engines/test/functional/view_helpers_test.rb37
-rw-r--r--vendor/plugins/engines/test/functional/view_loading_test.rb60
-rw-r--r--vendor/plugins/engines/test/lib/app_and_plugin_lib_model.rb3
-rw-r--r--vendor/plugins/engines/test/lib/engines_test_helper.rb42
-rw-r--r--vendor/plugins/engines/test/lib/render_information.rb7
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/alpha_plugin_controller.rb8
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/app_and_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/alpha_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/app_and_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/shared_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/shared_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/models/alpha_plugin_model.rb3
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/models/app_and_plugin_model.rb7
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/models/shared_plugin_model.rb3
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/alpha_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/app_and_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/layouts/plugin_layout.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/alpha_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/app_and_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/shared_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/app/views/shared_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/lib/alpha_plugin_lib_model.rb3
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/lib/app_and_plugin_lib_model.rb7
-rw-r--r--vendor/plugins/engines/test/plugins/alpha_plugin/locales/en.yml3
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/app_and_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/namespace/shared_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/shared_plugin_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/app/models/shared_plugin_model.rb3
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/app/views/namespace/shared_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/app/views/shared_plugin/a_view.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/init.rb1
-rw-r--r--vendor/plugins/engines/test/plugins/beta_plugin/locales/en.yml3
-rw-r--r--vendor/plugins/engines/test/plugins/not_a_plugin/public/should_not_be_copied.txt0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets/app/controllers/assets_controller.rb2
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets/app/views/assets/index.html.erb4
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets/app/views/layouts/assets.html.erb3
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets/public/file.txt0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets/public/subfolder/file_in_subfolder.txt0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/file.txt0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/subfolder/file_in_subfolder.txt0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/assets/file.txt0
-rw-r--r--vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_code_mixing/app/things/thing.rb3
-rw-r--r--vendor/plugins/engines/test/plugins/test_code_mixing/init.rb1
-rw-r--r--vendor/plugins/engines/test/plugins/test_load_path/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_migration/db/migrate/001_create_tests.rb11
-rw-r--r--vendor/plugins/engines/test/plugins/test_migration/db/migrate/002_create_others.rb11
-rw-r--r--vendor/plugins/engines/test/plugins/test_migration/db/migrate/003_create_extras.rb11
-rw-r--r--vendor/plugins/engines/test/plugins/test_migration/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/app/models/plugin_mail.rb26
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/mail_from_plugin.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_html.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_plain.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_html.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb1
-rw-r--r--vendor/plugins/engines/test/plugins/test_plugin_mailing/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_routing/app/controllers/namespace/test_routing_controller.rb5
-rw-r--r--vendor/plugins/engines/test/plugins/test_routing/app/controllers/test_routing_controller.rb9
-rw-r--r--vendor/plugins/engines/test/plugins/test_routing/config/routes.rb4
-rw-r--r--vendor/plugins/engines/test/plugins/test_routing/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_testing/app/README.txt1
-rw-r--r--vendor/plugins/engines/test/plugins/test_testing/init.rb0
-rw-r--r--vendor/plugins/engines/test/plugins/test_testing/test/fixtures/testing_fixtures.yml0
-rw-r--r--vendor/plugins/engines/test/plugins/test_testing/test/unit/override_test.rb13
-rw-r--r--vendor/plugins/engines/test/unit/action_mailer_test.rb54
-rw-r--r--vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb41
-rw-r--r--vendor/plugins/engines/test/unit/assets_test.rb52
-rw-r--r--vendor/plugins/engines/test/unit/backwards_compat_test.rb8
-rw-r--r--vendor/plugins/engines/test/unit/load_path_test.rb58
-rw-r--r--vendor/plugins/engines/test/unit/migration_test.rb63
-rw-r--r--vendor/plugins/engines/test/unit/model_and_lib_test.rb37
-rw-r--r--vendor/plugins/engines/test/unit/plugins_test.rb11
-rw-r--r--vendor/plugins/engines/test/unit/test_testing/override_test.rb7
-rw-r--r--vendor/plugins/engines/test/unit/testing_test.rb19
95 files changed, 893 insertions, 0 deletions
diff --git a/vendor/plugins/engines/test/app/controllers/app_and_plugin_controller.rb b/vendor/plugins/engines/test/app/controllers/app_and_plugin_controller.rb
new file mode 100644
index 000000000..90b13ff1f
--- /dev/null
+++ b/vendor/plugins/engines/test/app/controllers/app_and_plugin_controller.rb
@@ -0,0 +1,5 @@
+class AppAndPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from app'
+ end
+end
diff --git a/vendor/plugins/engines/test/app/controllers/namespace/app_and_plugin_controller.rb b/vendor/plugins/engines/test/app/controllers/namespace/app_and_plugin_controller.rb
new file mode 100644
index 000000000..05f9049e9
--- /dev/null
+++ b/vendor/plugins/engines/test/app/controllers/namespace/app_and_plugin_controller.rb
@@ -0,0 +1,5 @@
+class Namespace::AppAndPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from app'
+ end
+end
diff --git a/vendor/plugins/engines/test/app/helpers/mail_helper.rb b/vendor/plugins/engines/test/app/helpers/mail_helper.rb
new file mode 100644
index 000000000..9e081e75f
--- /dev/null
+++ b/vendor/plugins/engines/test/app/helpers/mail_helper.rb
@@ -0,0 +1,5 @@
+module MailHelper
+ def do_something_helpful(var)
+ var.to_s.reverse
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/models/app_and_plugin_model.rb b/vendor/plugins/engines/test/app/models/app_and_plugin_model.rb
new file mode 100644
index 000000000..f0fe903c4
--- /dev/null
+++ b/vendor/plugins/engines/test/app/models/app_and_plugin_model.rb
@@ -0,0 +1,3 @@
+class AppAndPluginModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/models/notify_mail.rb b/vendor/plugins/engines/test/app/models/notify_mail.rb
new file mode 100644
index 000000000..899fc1a40
--- /dev/null
+++ b/vendor/plugins/engines/test/app/models/notify_mail.rb
@@ -0,0 +1,26 @@
+class NotifyMail < ActionMailer::Base
+
+ helper :mail
+
+ def signup(txt)
+ body(:name => txt)
+ end
+
+ def multipart
+ recipients 'some_address@email.com'
+ subject 'multi part email'
+ from "another_user@email.com"
+ content_type 'multipart/alternative'
+
+ part :content_type => "text/html", :body => render_message("multipart_html", {})
+ part "text/plain" do |p|
+ p.body = render_message("multipart_plain", {})
+ end
+ end
+
+ def implicit_multipart
+ recipients 'some_address@email.com'
+ subject 'multi part email'
+ from "another_user@email.com"
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/things/thing.rb b/vendor/plugins/engines/test/app/things/thing.rb
new file mode 100644
index 000000000..ae6fbbf30
--- /dev/null
+++ b/vendor/plugins/engines/test/app/things/thing.rb
@@ -0,0 +1,3 @@
+class Thing
+ def self.from_app; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/app_and_plugin/a_view.html.erb b/vendor/plugins/engines/test/app/views/app_and_plugin/a_view.html.erb
new file mode 100644
index 000000000..03e2bf81d
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/app_and_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from app) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/namespace/app_and_plugin/a_view.html.erb b/vendor/plugins/engines/test/app/views/namespace/app_and_plugin/a_view.html.erb
new file mode 100644
index 000000000..03e2bf81d
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/namespace/app_and_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from app) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.html.erb b/vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.html.erb
new file mode 100644
index 000000000..042b5c4ef
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.html.erb
@@ -0,0 +1 @@
+the implicit html part of the email <%= do_something_helpful("semaj") %> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.plain.erb b/vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.plain.erb
new file mode 100644
index 000000000..552acc1ea
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.plain.erb
@@ -0,0 +1 @@
+the implicit plaintext part of the email \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/notify_mail/multipart_html.html.erb b/vendor/plugins/engines/test/app/views/notify_mail/multipart_html.html.erb
new file mode 100644
index 000000000..135488b17
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/notify_mail/multipart_html.html.erb
@@ -0,0 +1 @@
+the html part of the email <%= do_something_helpful("semaj") %> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/notify_mail/multipart_plain.html.erb b/vendor/plugins/engines/test/app/views/notify_mail/multipart_plain.html.erb
new file mode 100644
index 000000000..e0050461c
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/notify_mail/multipart_plain.html.erb
@@ -0,0 +1 @@
+the plaintext part of the email \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/notify_mail/signup.text.plain.erb b/vendor/plugins/engines/test/app/views/notify_mail/signup.text.plain.erb
new file mode 100644
index 000000000..5aaf46e97
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/notify_mail/signup.text.plain.erb
@@ -0,0 +1,5 @@
+Signup template from application
+
+Here's a local variable set in the Mail object: <%= @name %>.
+
+And here's a method called in a mail helper: <%= do_something_helpful(@name) %>
diff --git a/vendor/plugins/engines/test/app/views/plugin_mail/mail_from_plugin_with_application_template.text.plain.erb b/vendor/plugins/engines/test/app/views/plugin_mail/mail_from_plugin_with_application_template.text.plain.erb
new file mode 100644
index 000000000..67a6b8fa2
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/plugin_mail/mail_from_plugin_with_application_template.text.plain.erb
@@ -0,0 +1 @@
+<%= @note %> (from application) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb b/vendor/plugins/engines/test/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb
new file mode 100644
index 000000000..284e450f6
--- /dev/null
+++ b/vendor/plugins/engines/test/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb
@@ -0,0 +1 @@
+plugin mail template loaded from application \ No newline at end of file
diff --git a/vendor/plugins/engines/test/functional/controller_loading_test.rb b/vendor/plugins/engines/test/functional/controller_loading_test.rb
new file mode 100644
index 000000000..d51bc0007
--- /dev/null
+++ b/vendor/plugins/engines/test/functional/controller_loading_test.rb
@@ -0,0 +1,51 @@
+# Tests in this file ensure that:
+#
+# * plugin controller actions are found
+# * actions defined in application controllers take precedence over those in plugins
+# * actions in controllers in subsequently loaded plugins take precendence over those in previously loaded plugins
+# * this works for actions in namespaced controllers accordingly
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ControllerLoadingTest < ActionController::TestCase
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ # plugin controller actions should be found
+
+ def test_WITH_an_action_defined_only_in_a_plugin_IT_should_use_this_action
+ get_action_on_controller :an_action, :alpha_plugin
+ assert_response_body 'rendered in AlphaPluginController#an_action'
+ end
+
+ def test_WITH_an_action_defined_only_in_a_namespaced_plugin_controller_IT_should_use_this_action
+ get_action_on_controller :an_action, :alpha_plugin, :namespace
+ assert_response_body 'rendered in Namespace::AlphaPluginController#an_action'
+ end
+
+ # app takes precedence over plugins
+
+ def test_WITH_an_action_defined_in_both_app_and_plugin_IT_should_use_the_one_in_app
+ get_action_on_controller :an_action, :app_and_plugin
+ assert_response_body 'rendered in AppAndPluginController#an_action (from app)'
+ end
+
+ def test_WITH_an_action_defined_in_namespaced_controllers_in_both_app_and_plugin_IT_should_use_the_one_in_app
+ get_action_on_controller :an_action, :app_and_plugin, :namespace
+ assert_response_body 'rendered in Namespace::AppAndPluginController#an_action (from app)'
+ end
+
+ # subsequently loaded plugins take precendence over previously loaded plugins
+
+ def test_WITH_an_action_defined_in_two_plugin_controllers_IT_should_use_the_latter_of_both
+ get_action_on_controller :an_action, :shared_plugin
+ assert_response_body 'rendered in SharedPluginController#an_action (from beta_plugin)'
+ end
+
+ def test_WITH_an_action_defined_in_two_namespaced_plugin_controllers_IT_should_use_the_latter_of_both
+ get_action_on_controller :an_action, :shared_plugin, :namespace
+ assert_response_body 'rendered in Namespace::SharedPluginController#an_action (from beta_plugin)'
+ end
+end
diff --git a/vendor/plugins/engines/test/functional/exception_notification_compatibility_test.rb b/vendor/plugins/engines/test/functional/exception_notification_compatibility_test.rb
new file mode 100644
index 000000000..309330659
--- /dev/null
+++ b/vendor/plugins/engines/test/functional/exception_notification_compatibility_test.rb
@@ -0,0 +1,29 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ExceptionNotificationCompatibilityTest < ActionController::TestCase
+ ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)
+ class SimpleController < ApplicationController
+ include ExceptionNotifiable
+ local_addresses.clear
+ consider_all_requests_local = false
+ def index
+ begin
+ raise "Fail!"
+ rescue Exception => e
+ rescue_action_in_public(e)
+ end
+ end
+ end
+
+ def setup
+ @controller = SimpleController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ def test_should_work
+ assert_nothing_raised do
+ get :index
+ end
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/functional/locale_loading_test.rb b/vendor/plugins/engines/test/functional/locale_loading_test.rb
new file mode 100644
index 000000000..21c8c7f94
--- /dev/null
+++ b/vendor/plugins/engines/test/functional/locale_loading_test.rb
@@ -0,0 +1,26 @@
+# Tests in this file ensure that:
+#
+# * translations in the application take precedence over those in plugins
+# * translations in subsequently loaded plugins take precendence over those in previously loaded plugins
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class LocaleLoadingTest < ActionController::TestCase
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ # app takes precedence over plugins
+
+ def test_WITH_a_translation_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app
+ assert_equal I18n.t('hello'), 'Hello world'
+ end
+
+ # subsequently loaded plugins take precendence over previously loaded plugins
+
+ def test_WITH_a_translation_defined_in_two_plugins_IT_should_find_the_latter_of_both
+ assert_equal I18n.t('plugin'), 'beta'
+ end
+end
+
diff --git a/vendor/plugins/engines/test/functional/routes_test.rb b/vendor/plugins/engines/test/functional/routes_test.rb
new file mode 100644
index 000000000..733dd39f5
--- /dev/null
+++ b/vendor/plugins/engines/test/functional/routes_test.rb
@@ -0,0 +1,29 @@
+# Tests in this file ensure that:
+#
+# * Routes from plugins can be routed to
+# * Named routes can be defined within a plugin
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class RoutesTest < ActionController::TestCase
+ tests TestRoutingController
+
+ def test_WITH_a_route_defined_in_a_plugin_IT_should_route_it
+ path = '/routes/an_action'
+ opts = {:controller => 'test_routing', :action => 'an_action'}
+ assert_routing path, opts
+ assert_recognizes opts, path # not sure what exactly the difference is, but it won't hurt either
+ end
+
+ def test_WITH_a_route_for_a_namespaced_controller_defined_in_a_plugin_IT_should_route_it
+ path = 'somespace/routes/an_action'
+ opts = {:controller => 'namespace/test_routing', :action => 'an_action'}
+ assert_routing path, opts
+ assert_recognizes opts, path
+ end
+
+ def test_should_properly_generate_named_routes
+ get :test_named_routes_from_plugin
+ assert_response_body '/somespace/routes'
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/functional/view_helpers_test.rb b/vendor/plugins/engines/test/functional/view_helpers_test.rb
new file mode 100644
index 000000000..5448ffeb7
--- /dev/null
+++ b/vendor/plugins/engines/test/functional/view_helpers_test.rb
@@ -0,0 +1,37 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ViewHelpersTest < ActionController::TestCase
+ tests AssetsController
+
+ def setup
+ get :index
+ end
+
+ def test_plugin_javascript_helpers
+ base_selector = "script[type='text/javascript']"
+ js_dir = "/plugin_assets/test_assets/javascripts"
+ assert_select "#{base_selector}[src='#{js_dir}/file.1.js']"
+ assert_select "#{base_selector}[src='#{js_dir}/file2.js']"
+ end
+
+ def test_plugin_stylesheet_helpers
+ base_selector = "link[media='screen'][rel='stylesheet'][type='text/css']"
+ css_dir = "/plugin_assets/test_assets/stylesheets"
+ assert_select "#{base_selector}[href='#{css_dir}/file.1.css']"
+ assert_select "#{base_selector}[href='#{css_dir}/file2.css']"
+ end
+
+ def test_plugin_image_helpers
+ assert_select "img[src='/plugin_assets/test_assets/images/image.png'][alt='Image']"
+ end
+
+ def test_plugin_layouts
+ get :index
+ assert_select "div[id='assets_layout']"
+ end
+
+ def test_plugin_image_submit_helpers
+ assert_select "input[src='/plugin_assets/test_assets/images/image.png'][type='image']"
+ end
+
+end
diff --git a/vendor/plugins/engines/test/functional/view_loading_test.rb b/vendor/plugins/engines/test/functional/view_loading_test.rb
new file mode 100644
index 000000000..28d47546a
--- /dev/null
+++ b/vendor/plugins/engines/test/functional/view_loading_test.rb
@@ -0,0 +1,60 @@
+# Tests in this file ensure that:
+#
+# * plugin views are found
+# * views in the application take precedence over those in plugins
+# * views in subsequently loaded plugins take precendence over those in previously loaded plugins
+# * this works for namespaced views accordingly
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ViewLoadingTest < ActionController::TestCase
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ # plugin views should be found
+
+ def test_WITH_a_view_defined_only_in_a_plugin_IT_should_find_the_view
+ get_action_on_controller :a_view, :alpha_plugin
+ assert_response_body 'alpha_plugin/a_view'
+ end
+
+ def test_WITH_a_namespaced_view_defined_only_in_a_plugin_IT_should_find_the_view
+ get_action_on_controller :a_view, :alpha_plugin, :namespace
+ assert_response_body 'namespace/alpha_plugin/a_view'
+ end
+
+ # app takes precedence over plugins
+
+ def test_WITH_a_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app
+ get_action_on_controller :a_view, :app_and_plugin
+ assert_response_body 'app_and_plugin/a_view (from app)'
+ end
+
+ def test_WITH_a_namespaced_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app
+ get_action_on_controller :a_view, :app_and_plugin, :namespace
+ assert_response_body 'namespace/app_and_plugin/a_view (from app)'
+ end
+
+ # subsequently loaded plugins take precendence over previously loaded plugins
+
+ def test_WITH_a_view_defined_in_two_plugins_IT_should_find_the_latter_of_both
+ get_action_on_controller :a_view, :shared_plugin
+ assert_response_body 'shared_plugin/a_view (from beta_plugin)'
+ end
+
+ def test_WITH_a_namespaced_view_defined_in_two_plugins_IT_should_find_the_latter_of_both
+ get_action_on_controller :a_view, :shared_plugin, :namespace
+ assert_response_body 'namespace/shared_plugin/a_view (from beta_plugin)'
+ end
+
+ # layouts loaded from plugins
+
+ def test_should_be_able_to_load_a_layout_from_a_plugin
+ get_action_on_controller :action_with_layout, :alpha_plugin
+ assert_response_body 'rendered in AlphaPluginController#action_with_layout (with plugin layout)'
+ end
+
+end
+ \ No newline at end of file
diff --git a/vendor/plugins/engines/test/lib/app_and_plugin_lib_model.rb b/vendor/plugins/engines/test/lib/app_and_plugin_lib_model.rb
new file mode 100644
index 000000000..6ffe178a7
--- /dev/null
+++ b/vendor/plugins/engines/test/lib/app_and_plugin_lib_model.rb
@@ -0,0 +1,3 @@
+class AppAndPluginLibModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/lib/engines_test_helper.rb b/vendor/plugins/engines/test/lib/engines_test_helper.rb
new file mode 100644
index 000000000..47bd2bbfd
--- /dev/null
+++ b/vendor/plugins/engines/test/lib/engines_test_helper.rb
@@ -0,0 +1,42 @@
+module TestHelper
+ def self.report_location(path)
+ [RAILS_ROOT + '/', 'vendor/plugins/'].each { |part| path.sub! part, ''}
+ path = path.split('/')
+ location, subject = path.first, path.last
+ if subject.sub! '.rb', ''
+ subject = subject.classify
+ else
+ subject.sub! '.html.erb', ''
+ end
+ "#{subject} (from #{location})"
+ end
+
+ def self.view_path_for path
+ [RAILS_ROOT + '/', 'vendor/plugins/', '.html.erb'].each { |part| path.sub! part, ''}
+ parts = path.split('/')
+ parts[(parts.index('views')+1)..-1].join('/')
+ end
+end
+
+class Test::Unit::TestCase
+ # Add more helper methods to be used by all tests here...
+ def get_action_on_controller(*args)
+ action = args.shift
+ with_controller *args
+ get action
+ end
+
+ def with_controller(controller, namespace = nil)
+ classname = controller.to_s.classify + 'Controller'
+ classname = namespace.to_s.classify + '::' + classname unless namespace.nil?
+ @controller = classname.constantize.new
+ end
+
+ def assert_response_body(expected)
+ assert_equal expected, @response.body
+ end
+end
+
+# Because we're testing this behaviour, we actually want these features on!
+Engines.disable_application_view_loading = false
+Engines.disable_application_code_loading = false
diff --git a/vendor/plugins/engines/test/lib/render_information.rb b/vendor/plugins/engines/test/lib/render_information.rb
new file mode 100644
index 000000000..0deb5d9d3
--- /dev/null
+++ b/vendor/plugins/engines/test/lib/render_information.rb
@@ -0,0 +1,7 @@
+module RenderInformation
+ def render_class_and_action(note = nil, options={})
+ text = "rendered in #{self.class.name}##{params[:action]}"
+ text += " (#{note})" unless note.nil?
+ render options.update(:text => text)
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/alpha_plugin_controller.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/alpha_plugin_controller.rb
new file mode 100644
index 000000000..736d59b83
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/alpha_plugin_controller.rb
@@ -0,0 +1,8 @@
+class AlphaPluginController < ApplicationController
+ def an_action
+ render_class_and_action
+ end
+ def action_with_layout
+ render_class_and_action(nil, :layout => "plugin_layout")
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/app_and_plugin_controller.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/app_and_plugin_controller.rb
new file mode 100644
index 000000000..c41d6edd1
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/app_and_plugin_controller.rb
@@ -0,0 +1,5 @@
+class AppAndPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from alpha_plugin'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/alpha_plugin_controller.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/alpha_plugin_controller.rb
new file mode 100644
index 000000000..5edf81b53
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/alpha_plugin_controller.rb
@@ -0,0 +1,5 @@
+class Namespace::AlphaPluginController < ApplicationController
+ def an_action
+ render_class_and_action
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/app_and_plugin_controller.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/app_and_plugin_controller.rb
new file mode 100644
index 000000000..7431a36b6
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/app_and_plugin_controller.rb
@@ -0,0 +1,5 @@
+class Namespace::AppAndPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from alpha_plugin'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/shared_plugin_controller.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/shared_plugin_controller.rb
new file mode 100644
index 000000000..fb162bcf6
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/shared_plugin_controller.rb
@@ -0,0 +1,5 @@
+class Namespace::SharedPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from alpha_plugin'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/shared_plugin_controller.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/shared_plugin_controller.rb
new file mode 100644
index 000000000..00539bb8c
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/shared_plugin_controller.rb
@@ -0,0 +1,5 @@
+class SharedEngineController < ApplicationController
+ def an_action
+ render_class_and_action 'from alpha_engine'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/alpha_plugin_model.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/alpha_plugin_model.rb
new file mode 100644
index 000000000..cde71b8d0
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/alpha_plugin_model.rb
@@ -0,0 +1,3 @@
+class AlphaPluginModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/app_and_plugin_model.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/app_and_plugin_model.rb
new file mode 100644
index 000000000..92e6e625f
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/app_and_plugin_model.rb
@@ -0,0 +1,7 @@
+class AppAndPluginModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+
+ def defined_only_in_alpha_plugin_version
+ # should not be defined as the model in app/models takes precedence
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/shared_plugin_model.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/shared_plugin_model.rb
new file mode 100644
index 000000000..e2ef43db7
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/models/shared_plugin_model.rb
@@ -0,0 +1,3 @@
+class SharedPluginModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/alpha_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/alpha_plugin/a_view.html.erb
new file mode 100644
index 000000000..1ad694584
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/alpha_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/app_and_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/app_and_plugin/a_view.html.erb
new file mode 100644
index 000000000..791a6fab4
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/app_and_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from a_view) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/layouts/plugin_layout.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/layouts/plugin_layout.erb
new file mode 100644
index 000000000..878e07c2c
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/layouts/plugin_layout.erb
@@ -0,0 +1 @@
+<%= yield %> (with plugin layout) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/alpha_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/alpha_plugin/a_view.html.erb
new file mode 100644
index 000000000..1ad694584
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/alpha_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/app_and_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/app_and_plugin/a_view.html.erb
new file mode 100644
index 000000000..1ad694584
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/app_and_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/shared_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/shared_plugin/a_view.html.erb
new file mode 100644
index 000000000..f144ab394
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/shared_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from alpha_plugin) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/shared_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/shared_plugin/a_view.html.erb
new file mode 100644
index 000000000..f144ab394
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/app/views/shared_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from alpha_plugin) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/lib/alpha_plugin_lib_model.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/lib/alpha_plugin_lib_model.rb
new file mode 100644
index 000000000..0ce4f91bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/lib/alpha_plugin_lib_model.rb
@@ -0,0 +1,3 @@
+class AlphaPluginLibModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/lib/app_and_plugin_lib_model.rb b/vendor/plugins/engines/test/plugins/alpha_plugin/lib/app_and_plugin_lib_model.rb
new file mode 100644
index 000000000..645a70c83
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/lib/app_and_plugin_lib_model.rb
@@ -0,0 +1,7 @@
+class AppAndPluginLibModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+
+ def defined_only_in_alpha_plugin_version
+ # should not be defined
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/alpha_plugin/locales/en.yml b/vendor/plugins/engines/test/plugins/alpha_plugin/locales/en.yml
new file mode 100644
index 000000000..76d39d315
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/alpha_plugin/locales/en.yml
@@ -0,0 +1,3 @@
+en:
+ hello: "Hello from alfa"
+ plugin: "alfa"
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/app_and_plugin_controller.rb b/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/app_and_plugin_controller.rb
new file mode 100644
index 000000000..2e7798976
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/app_and_plugin_controller.rb
@@ -0,0 +1,5 @@
+class AppAndPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from beta_plugin'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/namespace/shared_plugin_controller.rb b/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/namespace/shared_plugin_controller.rb
new file mode 100644
index 000000000..971c7d563
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/namespace/shared_plugin_controller.rb
@@ -0,0 +1,5 @@
+class Namespace::SharedPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from beta_plugin'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/shared_plugin_controller.rb b/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/shared_plugin_controller.rb
new file mode 100644
index 000000000..ddd9dbede
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/shared_plugin_controller.rb
@@ -0,0 +1,5 @@
+class SharedPluginController < ApplicationController
+ def an_action
+ render_class_and_action 'from beta_plugin'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/app/models/shared_plugin_model.rb b/vendor/plugins/engines/test/plugins/beta_plugin/app/models/shared_plugin_model.rb
new file mode 100644
index 000000000..bfde227d1
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/app/models/shared_plugin_model.rb
@@ -0,0 +1,3 @@
+class SharedPluginModel < ActiveRecord::Base
+ def self.report_location; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/app/views/namespace/shared_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/beta_plugin/app/views/namespace/shared_plugin/a_view.html.erb
new file mode 100644
index 000000000..77b5a1538
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/app/views/namespace/shared_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from beta_plugin) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/app/views/shared_plugin/a_view.html.erb b/vendor/plugins/engines/test/plugins/beta_plugin/app/views/shared_plugin/a_view.html.erb
new file mode 100644
index 000000000..77b5a1538
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/app/views/shared_plugin/a_view.html.erb
@@ -0,0 +1 @@
+<%= TestHelper.view_path_for __FILE__ %> (from beta_plugin) \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/init.rb b/vendor/plugins/engines/test/plugins/beta_plugin/init.rb
new file mode 100644
index 000000000..b4c4b0e1d
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/init.rb
@@ -0,0 +1 @@
+# just here so that Rails recognizes this as a plugin \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/beta_plugin/locales/en.yml b/vendor/plugins/engines/test/plugins/beta_plugin/locales/en.yml
new file mode 100644
index 000000000..f49279cca
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/beta_plugin/locales/en.yml
@@ -0,0 +1,3 @@
+en:
+ hello: "Hello from beta"
+ plugin: "beta"
diff --git a/vendor/plugins/engines/test/plugins/not_a_plugin/public/should_not_be_copied.txt b/vendor/plugins/engines/test/plugins/not_a_plugin/public/should_not_be_copied.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/not_a_plugin/public/should_not_be_copied.txt
diff --git a/vendor/plugins/engines/test/plugins/test_assets/app/controllers/assets_controller.rb b/vendor/plugins/engines/test/plugins/test_assets/app/controllers/assets_controller.rb
new file mode 100644
index 000000000..db5de2e6a
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets/app/controllers/assets_controller.rb
@@ -0,0 +1,2 @@
+class AssetsController < ApplicationController
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_assets/app/views/assets/index.html.erb b/vendor/plugins/engines/test/plugins/test_assets/app/views/assets/index.html.erb
new file mode 100644
index 000000000..8340f76d1
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets/app/views/assets/index.html.erb
@@ -0,0 +1,4 @@
+<%= image_tag 'image.png', :plugin => 'test_assets' %>
+<%= javascript_include_tag 'file.1.js', 'file2', :plugin => "test_assets" %>
+<%= stylesheet_link_tag 'file.1.css', 'file2', :plugin => "test_assets" %>
+<%= image_submit_tag 'image.png', :plugin => "test_assets" %>
diff --git a/vendor/plugins/engines/test/plugins/test_assets/app/views/layouts/assets.html.erb b/vendor/plugins/engines/test/plugins/test_assets/app/views/layouts/assets.html.erb
new file mode 100644
index 000000000..b7da375e9
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets/app/views/layouts/assets.html.erb
@@ -0,0 +1,3 @@
+<div id="assets_layout">
+ <%= yield %>
+</div> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_assets/init.rb b/vendor/plugins/engines/test/plugins/test_assets/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_assets/public/file.txt b/vendor/plugins/engines/test/plugins/test_assets/public/file.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets/public/file.txt
diff --git a/vendor/plugins/engines/test/plugins/test_assets/public/subfolder/file_in_subfolder.txt b/vendor/plugins/engines/test/plugins/test_assets/public/subfolder/file_in_subfolder.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets/public/subfolder/file_in_subfolder.txt
diff --git a/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/file.txt b/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/file.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/file.txt
diff --git a/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/subfolder/file_in_subfolder.txt b/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/subfolder/file_in_subfolder.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/subfolder/file_in_subfolder.txt
diff --git a/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/init.rb b/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/assets/file.txt b/vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/assets/file.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/assets/file.txt
diff --git a/vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/init.rb b/vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_code_mixing/app/things/thing.rb b/vendor/plugins/engines/test/plugins/test_code_mixing/app/things/thing.rb
new file mode 100644
index 000000000..535d988e6
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_code_mixing/app/things/thing.rb
@@ -0,0 +1,3 @@
+class Thing
+ def self.from_plugin; TestHelper::report_location(__FILE__); end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_code_mixing/init.rb b/vendor/plugins/engines/test/plugins/test_code_mixing/init.rb
new file mode 100644
index 000000000..b4c4b0e1d
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_code_mixing/init.rb
@@ -0,0 +1 @@
+# just here so that Rails recognizes this as a plugin \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_load_path/init.rb b/vendor/plugins/engines/test/plugins/test_load_path/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_load_path/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_migration/db/migrate/001_create_tests.rb b/vendor/plugins/engines/test/plugins/test_migration/db/migrate/001_create_tests.rb
new file mode 100644
index 000000000..804a0cd2d
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_migration/db/migrate/001_create_tests.rb
@@ -0,0 +1,11 @@
+class CreateTests < ActiveRecord::Migration
+ def self.up
+ create_table 'tests' do |t|
+ t.column 'name', :string
+ end
+ end
+
+ def self.down
+ drop_table 'tests'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/test_migration/db/migrate/002_create_others.rb b/vendor/plugins/engines/test/plugins/test_migration/db/migrate/002_create_others.rb
new file mode 100644
index 000000000..756aca653
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_migration/db/migrate/002_create_others.rb
@@ -0,0 +1,11 @@
+class CreateOthers < ActiveRecord::Migration
+ def self.up
+ create_table 'others' do |t|
+ t.column 'name', :string
+ end
+ end
+
+ def self.down
+ drop_table 'others'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/test_migration/db/migrate/003_create_extras.rb b/vendor/plugins/engines/test/plugins/test_migration/db/migrate/003_create_extras.rb
new file mode 100644
index 000000000..fb5b6c205
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_migration/db/migrate/003_create_extras.rb
@@ -0,0 +1,11 @@
+class CreateExtras < ActiveRecord::Migration
+ def self.up
+ create_table 'extras' do |t|
+ t.column 'name', :string
+ end
+ end
+
+ def self.down
+ drop_table 'extras'
+ end
+end
diff --git a/vendor/plugins/engines/test/plugins/test_migration/init.rb b/vendor/plugins/engines/test/plugins/test_migration/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_migration/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/models/plugin_mail.rb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/models/plugin_mail.rb
new file mode 100644
index 000000000..4f3661639
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/models/plugin_mail.rb
@@ -0,0 +1,26 @@
+class PluginMail < ActionMailer::Base
+ def mail_from_plugin(note=nil)
+ body(:note => note)
+ end
+
+ def mail_from_plugin_with_application_template(note=nil)
+ body(:note => note)
+ end
+
+ def multipart_from_plugin
+ content_type 'multipart/alternative'
+ part :content_type => "text/html", :body => render_message("multipart_from_plugin_html", {})
+ part "text/plain" do |p|
+ p.body = render_message("multipart_from_plugin_plain", {})
+ end
+ end
+
+ def multipart_from_plugin_with_application_template
+ content_type 'multipart/alternative'
+ part :content_type => "text/html", :body => render_message("multipart_from_plugin_with_application_template_html", {})
+ part "text/plain" do |p|
+ p.body = render_message("multipart_from_plugin_with_application_template_plain", {})
+ end
+ end
+
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/mail_from_plugin.erb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/mail_from_plugin.erb
new file mode 100644
index 000000000..2b4960625
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/mail_from_plugin.erb
@@ -0,0 +1 @@
+<%= @note %> \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_html.html.erb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_html.html.erb
new file mode 100644
index 000000000..46291d8f0
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_html.html.erb
@@ -0,0 +1 @@
+html template \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_plain.html.erb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_plain.html.erb
new file mode 100644
index 000000000..f690dbaac
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_plain.html.erb
@@ -0,0 +1 @@
+plain template \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_html.html.erb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_html.html.erb
new file mode 100644
index 000000000..795f0d508
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_html.html.erb
@@ -0,0 +1 @@
+template from plugin \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb
new file mode 100644
index 000000000..795f0d508
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb
@@ -0,0 +1 @@
+template from plugin \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_plugin_mailing/init.rb b/vendor/plugins/engines/test/plugins/test_plugin_mailing/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_plugin_mailing/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_routing/app/controllers/namespace/test_routing_controller.rb b/vendor/plugins/engines/test/plugins/test_routing/app/controllers/namespace/test_routing_controller.rb
new file mode 100644
index 000000000..29d7bdbd4
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_routing/app/controllers/namespace/test_routing_controller.rb
@@ -0,0 +1,5 @@
+class Namespace::TestRoutingController < ApplicationController
+ def routed_action
+ render_class_and_action
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_routing/app/controllers/test_routing_controller.rb b/vendor/plugins/engines/test/plugins/test_routing/app/controllers/test_routing_controller.rb
new file mode 100644
index 000000000..ac3164a4f
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_routing/app/controllers/test_routing_controller.rb
@@ -0,0 +1,9 @@
+class TestRoutingController < ApplicationController
+ def routed_action
+ render_class_and_action
+ end
+
+ def test_named_routes_from_plugin
+ render :text => plugin_route_path(:action => "index")
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_routing/config/routes.rb b/vendor/plugins/engines/test/plugins/test_routing/config/routes.rb
new file mode 100644
index 000000000..dbc49f960
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_routing/config/routes.rb
@@ -0,0 +1,4 @@
+ActionController::Routing::Routes.draw do |map|
+ map.connect 'routes/:action', :controller => "test_routing"
+ map.plugin_route 'somespace/routes/:action', :controller => "namespace/test_routing"
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_routing/init.rb b/vendor/plugins/engines/test/plugins/test_routing/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_routing/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_testing/app/README.txt b/vendor/plugins/engines/test/plugins/test_testing/app/README.txt
new file mode 100644
index 000000000..784e4fe28
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_testing/app/README.txt
@@ -0,0 +1 @@
+Fixtures are only copied from plugins with an +app+ directory, but git needs this directory to be non-empty \ No newline at end of file
diff --git a/vendor/plugins/engines/test/plugins/test_testing/init.rb b/vendor/plugins/engines/test/plugins/test_testing/init.rb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_testing/init.rb
diff --git a/vendor/plugins/engines/test/plugins/test_testing/test/fixtures/testing_fixtures.yml b/vendor/plugins/engines/test/plugins/test_testing/test/fixtures/testing_fixtures.yml
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_testing/test/fixtures/testing_fixtures.yml
diff --git a/vendor/plugins/engines/test/plugins/test_testing/test/unit/override_test.rb b/vendor/plugins/engines/test/plugins/test_testing/test/unit/override_test.rb
new file mode 100644
index 000000000..4c4c42a2c
--- /dev/null
+++ b/vendor/plugins/engines/test/plugins/test_testing/test/unit/override_test.rb
@@ -0,0 +1,13 @@
+require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. .. .. .. test test_helper]))
+
+class OverrideTest < ActiveSupport::TestCase
+ def test_overrides_from_the_application_should_work
+ flunk "this test should be overridden by the app"
+ end
+
+ def test_tests_within_the_plugin_should_still_run
+ assert true, "non-overridden plugin tests should still run"
+ end
+end
+
+Engines::Testing.override_tests_from_app \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/action_mailer_test.rb b/vendor/plugins/engines/test/unit/action_mailer_test.rb
new file mode 100644
index 000000000..fc3e75661
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/action_mailer_test.rb
@@ -0,0 +1,54 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ActionMailerWithinApplicationTest < Test::Unit::TestCase
+
+ def test_normal_implicit_template
+ m = NotifyMail.create_signup("hello")
+ assert m.body =~ /^Signup template from application/
+ end
+
+ def test_action_mailer_can_get_helper
+ m = NotifyMail.create_signup('James')
+ assert m.body =~ /James/
+ assert m.body =~ /semaJ/ # from the helper
+ end
+
+ def test_multipart_mails_with_explicit_templates
+ m = NotifyMail.create_multipart
+ assert_equal 2, m.parts.length
+ assert_equal 'the html part of the email james', m.parts[0].body
+ assert_equal 'the plaintext part of the email', m.parts[1].body
+ end
+
+ def test_multipart_mails_with_implicit_templates
+ m = NotifyMail.create_implicit_multipart
+ assert_equal 2, m.parts.length
+ assert_equal 'the implicit plaintext part of the email', m.parts[0].body
+ assert_equal 'the implicit html part of the email james', m.parts[1].body
+ end
+end
+
+
+class ActionMailerWithinPluginsTest < Test::Unit::TestCase
+ def test_should_be_able_to_create_mails_from_plugin
+ m = PluginMail.create_mail_from_plugin("from_plugin")
+ assert_equal "from_plugin", m.body
+ end
+
+ def test_should_be_able_to_overload_views_within_the_application
+ m = PluginMail.create_mail_from_plugin_with_application_template("from_plugin")
+ assert_equal "from_plugin (from application)", m.body
+ end
+
+ def test_should_be_able_to_create_a_multipart_mail_from_within_plugin
+ m = PluginMail.create_multipart_from_plugin
+ assert_equal 2, m.parts.length
+ assert_equal 'html template', m.parts[0].body
+ assert_equal 'plain template', m.parts[1].body
+ end
+
+ def test_plugin_mailer_template_overriding
+ m = PluginMail.create_multipart_from_plugin_with_application_template
+ assert_equal 'plugin mail template loaded from application', m.parts[1].body
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb b/vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb
new file mode 100644
index 000000000..4b862f35b
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb
@@ -0,0 +1,41 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ArbitraryCodeMixingTest < Test::Unit::TestCase
+ def setup
+ Engines.code_mixing_file_types = %w(controller helper)
+ end
+
+ def test_should_allow_setting_of_different_code_mixing_file_types
+ assert_nothing_raised {
+ Engines.mix_code_from :things
+ }
+ end
+
+ def test_should_add_new_types_to_existing_code_mixing_file_types
+ Engines.mix_code_from :things
+ assert_equal ["controller", "helper", "thing"], Engines.code_mixing_file_types
+ Engines.mix_code_from :other
+ assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types
+ end
+
+ def test_should_allow_setting_of_multiple_types_at_once
+ Engines.mix_code_from :things, :other
+ assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types
+ end
+
+ def test_should_singularize_elements_to_be_mixed
+ # this is the only test using mocha, so let's try to work around it
+ # also, this seems to be already tested with the :things in the tests above
+ # arg = stub(:to_s => stub(:singularize => "element"))
+ Engines.mix_code_from :elements
+ assert Engines.code_mixing_file_types.include?("element")
+ end
+
+ # TODO doesn't seem to work as expected?
+
+ # def test_should_successfully_mix_custom_types
+ # Engines.mix_code_from :things
+ # assert_equal 'Thing (from app)', Thing.from_app
+ # assert_equal 'Thing (from test_code_mixing)', Thing.from_plugin
+ # end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/assets_test.rb b/vendor/plugins/engines/test/unit/assets_test.rb
new file mode 100644
index 000000000..3332c533e
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/assets_test.rb
@@ -0,0 +1,52 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class AssetsTest < Test::Unit::TestCase
+ def setup
+ Engines::Assets.mirror_files_for Engines.plugins[:test_assets]
+ end
+
+ def teardown
+ FileUtils.rm_r(Engines.public_directory) if File.exist?(Engines.public_directory)
+ end
+
+ def test_engines_has_created_base_public_file
+ assert File.exist?(Engines.public_directory)
+ end
+
+ def test_engines_has_created_README_in_public_directory
+ assert File.exist?(File.join(Engines.public_directory, 'README'))
+ end
+
+ def test_public_files_have_been_copied_from_test_assets_plugin
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'file.txt'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder', 'file_in_subfolder.txt'))
+ end
+
+ def test_engines_has_not_created_duplicated_file_structure
+ assert !File.exists?(File.join(Engines.public_directory, "test_assets", RAILS_ROOT))
+ end
+
+ def test_public_files_have_been_copied_from_test_assets_with_assets_dir_plugin
+ Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_assets_directory]
+
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'file.txt'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'subfolder'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'subfolder', 'file_in_subfolder.txt'))
+ end
+
+ def test_public_files_have_been_copied_from_test_assets_with_no_subdirectory_plugin
+ Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_no_subdirectory]
+
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_no_subdirectory'))
+ assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_no_subdirectory', 'file.txt'))
+ end
+
+ def test_public_files_have_NOT_been_copied_from_plugins_without_public_or_asset_directories
+ Engines::Assets.mirror_files_for Engines.plugins[:alpha_plugin]
+
+ assert !File.exist?(File.join(Engines.public_directory, 'alpha_plugin'))
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/backwards_compat_test.rb b/vendor/plugins/engines/test/unit/backwards_compat_test.rb
new file mode 100644
index 000000000..4fa3698f2
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/backwards_compat_test.rb
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class BackwardsCompatibilityTest < Test::Unit::TestCase
+ def test_rails_module_plugin_method_should_delegate_to_engines_plugins
+ assert_nothing_raised { Rails.plugins }
+ assert_equal Engines.plugins, Rails.plugins
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/load_path_test.rb b/vendor/plugins/engines/test/unit/load_path_test.rb
new file mode 100644
index 000000000..c26d331c3
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/load_path_test.rb
@@ -0,0 +1,58 @@
+# Tests in this file ensure that:
+#
+# * the application /app/[controllers|helpers|models] and /lib
+# paths preceed the corresponding plugin paths
+# * the plugin paths are added to $LOAD_PATH in the order in which plugins are
+# loaded
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class LoadPathTest < Test::Unit::TestCase
+ def setup
+ @load_path = expand_paths($LOAD_PATH)
+ end
+
+ # Not sure if these test actually make sense as this now essentially tests
+ # Rails core functionality. On the other hand Engines relies on this to some
+ # extend so this will choke if something important changes in Rails.
+
+ # the application app/... and lib/ directories should appear
+ # before any plugin directories
+
+ def test_application_app_libs_should_precede_all_plugin_app_libs
+ types = %w(app/controllers app/helpers app/models lib)
+ types.each do |t|
+ app_index = load_path_index(File.join(RAILS_ROOT, t))
+ assert_not_nil app_index, "#{t} is missing in $LOAD_PATH"
+ Engines.plugins.each do |plugin|
+ first_plugin_index = load_path_index(File.join(plugin.directory, t))
+ assert(app_index < first_plugin_index) unless first_plugin_index.nil?
+ end
+ end
+ end
+
+ # the engine directories should appear in the proper order based on
+ # the order they were started
+
+ def test_plugin_dirs_should_appear_in_reverse_plugin_loading_order
+ app_paths = %w(app/controllers/ app app/models app/helpers lib)
+ app_paths.map { |p| File.join(RAILS_ROOT, p)}
+ plugin_paths = Engines.plugins.reverse.collect { |plugin| plugin.load_paths.reverse }.flatten
+
+ expected_paths = expand_paths(app_paths + plugin_paths)
+ # only look at those paths that are also present in expected_paths so
+ # the only difference would be in the order of the paths
+ actual_paths = @load_path & expected_paths
+
+ assert_equal expected_paths, actual_paths
+ end
+
+ protected
+ def expand_paths(paths)
+ paths.collect { |p| File.expand_path(p) }
+ end
+
+ def load_path_index(dir)
+ @load_path.index(File.expand_path(dir))
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/migration_test.rb b/vendor/plugins/engines/test/unit/migration_test.rb
new file mode 100644
index 000000000..eae7fe7d4
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/migration_test.rb
@@ -0,0 +1,63 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'rails_generator'
+require 'rails_generator/scripts/generate'
+
+class MigrationsTest < Test::Unit::TestCase
+
+ @@migration_dir = "#{RAILS_ROOT}/db/migrate"
+
+ def setup
+ ActiveRecord::Migration.verbose = false
+ Engines.plugins[:test_migration].migrate(0)
+ end
+
+ def teardown
+ FileUtils.rm_r(@@migration_dir) if File.exist?(@@migration_dir)
+ end
+
+ def test_engine_migrations_can_run_down
+ assert !table_exists?('tests'), ActiveRecord::Base.connection.tables.inspect
+ assert !table_exists?('others'), ActiveRecord::Base.connection.tables.inspect
+ assert !table_exists?('extras'), ActiveRecord::Base.connection.tables.inspect
+ end
+
+ def test_engine_migrations_can_run_up
+ Engines.plugins[:test_migration].migrate(3)
+ assert table_exists?('tests')
+ assert table_exists?('others')
+ assert table_exists?('extras')
+ end
+
+ def test_engine_migrations_can_upgrade_incrementally
+ Engines.plugins[:test_migration].migrate(1)
+ assert table_exists?('tests')
+ assert !table_exists?('others')
+ assert !table_exists?('extras')
+ assert_equal 1, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration])
+
+
+ Engines.plugins[:test_migration].migrate(2)
+ assert table_exists?('others')
+ assert_equal 2, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration])
+
+
+ Engines.plugins[:test_migration].migrate(3)
+ assert table_exists?('extras')
+ assert_equal 3, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration])
+ end
+
+ def test_generator_creates_plugin_migration_file
+ Rails::Generator::Scripts::Generate.new.run(['plugin_migration', 'test_migration'], :quiet => true)
+ assert migration_file, "migration file is missing"
+ end
+
+ private
+
+ def table_exists?(table)
+ ActiveRecord::Base.connection.tables.include?(table)
+ end
+
+ def migration_file
+ Dir["#{@@migration_dir}/*test_migration_to_version_3.rb"][0]
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/model_and_lib_test.rb b/vendor/plugins/engines/test/unit/model_and_lib_test.rb
new file mode 100644
index 000000000..e5aa773ba
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/model_and_lib_test.rb
@@ -0,0 +1,37 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class ModelAndLibTest < Test::Unit::TestCase
+
+ def test_WITH_a_model_defined_only_in_a_plugin_IT_should_load_the_model
+ assert_equal 'AlphaPluginModel (from alpha_plugin)', AlphaPluginModel.report_location
+ end
+
+ def test_WITH_a_model_defined_only_in_a_plugin_lib_dir_IT_should_load_the_model
+ assert_equal 'AlphaPluginLibModel (from alpha_plugin)', AlphaPluginLibModel.report_location
+ end
+
+ # app takes precedence over plugins
+
+ def test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app
+ assert_equal 'AppAndPluginModel (from app)', AppAndPluginModel.report_location
+ assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version }
+ end
+
+ def test_WITH_a_model_defined_in_both_app_and_plugin_lib_dirs_IT_should_load_the_one_in_app
+ assert_equal 'AppAndPluginLibModel (from lib)', AppAndPluginLibModel.report_location
+ assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version }
+ end
+
+ # subsequently loaded plugins take precendence over previously loaded plugins
+
+ # TODO
+ #
+ # this does work when we rely on $LOAD_PATH while it won't work when we use
+ # Dependency constant autoloading. This somewhat confusing difference has
+ # been there since at least Rails 1.2.x. See http://www.ruby-forum.com/topic/134529
+
+ def test_WITH_a_model_defined_in_two_plugins_IT_should_load_the_latter_of_both
+ require 'shared_plugin_model'
+ assert_equal SharedPluginModel.report_location, 'SharedPluginModel (from beta_plugin)'
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/plugins_test.rb b/vendor/plugins/engines/test/unit/plugins_test.rb
new file mode 100644
index 000000000..f8627bcee
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/plugins_test.rb
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class PluginsTest < Test::Unit::TestCase
+
+ def test_should_allow_access_to_plugins_by_strings_or_symbols
+ p = Engines.plugins["alpha_plugin"]
+ q = Engines.plugins[:alpha_plugin]
+ assert_kind_of Engines::Plugin, p
+ assert_equal p, q
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/test_testing/override_test.rb b/vendor/plugins/engines/test/unit/test_testing/override_test.rb
new file mode 100644
index 000000000..ea58a51c3
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/test_testing/override_test.rb
@@ -0,0 +1,7 @@
+require File.join(File.dirname(__FILE__), *%w[.. .. test_helper])
+
+class OverrideTest < ActiveSupport::TestCase
+ def test_overrides_from_the_application_should_work
+ assert true, "overriding plugin tests from the application should work"
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/engines/test/unit/testing_test.rb b/vendor/plugins/engines/test/unit/testing_test.rb
new file mode 100644
index 000000000..c0c37ed40
--- /dev/null
+++ b/vendor/plugins/engines/test/unit/testing_test.rb
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class TestingTest < Test::Unit::TestCase
+ def setup
+ Engines::Testing.set_fixture_path
+ @filename = File.join(Engines::Testing.temporary_fixtures_directory, 'testing_fixtures.yml')
+ File.delete(@filename) if File.exists?(@filename)
+ end
+
+ def teardown
+ File.delete(@filename) if File.exists?(@filename)
+ end
+
+ def test_should_copy_fixtures_files_to_tmp_directory
+ assert !File.exists?(@filename)
+ Engines::Testing.setup_plugin_fixtures
+ assert File.exists?(@filename)
+ end
+end \ No newline at end of file