]> source.dussan.org Git - redmine.git/commitdiff
Upgraded to Rails 2.3.4 (#3597)
authorEric Davis <edavis@littlestreamsoftware.com>
Sun, 13 Sep 2009 17:14:35 +0000 (17:14 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sun, 13 Sep 2009 17:14:35 +0000 (17:14 +0000)
* 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

266 files changed:
app/controllers/application.rb [deleted file]
app/controllers/application_controller.rb [new file with mode: 0644]
app/controllers/repositories_controller.rb
app/models/mailer.rb
app/views/layouts/mailer.text.html.erb [new file with mode: 0644]
app/views/layouts/mailer.text.plain.erb [new file with mode: 0644]
app/views/mailer/layout.text.html.rhtml [deleted file]
app/views/mailer/layout.text.plain.rhtml [deleted file]
app/views/settings/_authentication.rhtml
app/views/settings/_display.rhtml
app/views/settings/_issues.rhtml
app/views/settings/_mail_handler.rhtml
app/views/settings/_notifications.rhtml
app/views/settings/_projects.rhtml
app/views/settings/_repositories.rhtml
config/boot.rb
config/environment.rb
config/initializers/10-patches.rb
config/initializers/backtrace_silencers.rb [new file with mode: 0644]
config/initializers/inflections.rb [new file with mode: 0644]
config/locales/bg.yml
config/locales/bs.yml
config/locales/ca.yml
config/locales/cs.yml
config/locales/da.yml
config/locales/de.yml
config/locales/el.yml
config/locales/en.yml
config/locales/es.yml
config/locales/fi.yml
config/locales/fr.yml
config/locales/gl.yml
config/locales/he.yml
config/locales/hu.yml
config/locales/it.yml
config/locales/ja.yml
config/locales/ko.yml
config/locales/lt.yml
config/locales/nl.yml
config/locales/no.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/pt.yml
config/locales/ro.yml
config/locales/sk.yml
config/locales/sl.yml
config/locales/sr.yml
config/locales/sv.yml
config/locales/th.yml
config/locales/tr.yml
config/locales/uk.yml
config/locales/vi.yml
config/locales/zh-TW.yml
config/locales/zh.yml
config/routes.rb
lib/tabular_form_builder.rb
test/functional/account_controller_test.rb
test/functional/admin_controller_test.rb
test/functional/application_controller_test.rb
test/functional/attachments_controller_test.rb
test/functional/boards_controller_test.rb
test/functional/custom_fields_controller_test.rb
test/functional/documents_controller_test.rb
test/functional/enumerations_controller_test.rb
test/functional/groups_controller_test.rb
test/functional/issue_categories_controller_test.rb
test/functional/issue_relations_controller_test.rb
test/functional/issues_controller_test.rb
test/functional/journals_controller_test.rb
test/functional/mail_handler_controller_test.rb
test/functional/members_controller_test.rb
test/functional/messages_controller_test.rb
test/functional/my_controller_test.rb
test/functional/news_controller_test.rb
test/functional/projects_controller_test.rb
test/functional/queries_controller_test.rb
test/functional/reports_controller_test.rb
test/functional/repositories_bazaar_controller_test.rb
test/functional/repositories_controller_test.rb
test/functional/repositories_cvs_controller_test.rb
test/functional/repositories_darcs_controller_test.rb
test/functional/repositories_git_controller_test.rb
test/functional/repositories_mercurial_controller_test.rb
test/functional/repositories_subversion_controller_test.rb
test/functional/roles_controller_test.rb
test/functional/search_controller_test.rb
test/functional/settings_controller_test.rb
test/functional/sys_controller_test.rb
test/functional/timelog_controller_test.rb
test/functional/trackers_controller_test.rb
test/functional/users_controller_test.rb
test/functional/versions_controller_test.rb
test/functional/watchers_controller_test.rb
test/functional/welcome_controller_test.rb
test/functional/wiki_controller_test.rb
test/functional/wikis_controller_test.rb
test/functional/workflows_controller_test.rb
test/helper_testcase.rb
test/test_helper.rb
test/unit/activity_test.rb
test/unit/attachment_test.rb
test/unit/auth_source_ldap_test.rb
test/unit/board_test.rb
test/unit/calendar_test.rb
test/unit/changeset_test.rb
test/unit/comment_test.rb
test/unit/custom_field_test.rb
test/unit/custom_value_test.rb
test/unit/default_data_test.rb
test/unit/document_category_test.rb
test/unit/document_test.rb
test/unit/enabled_module_test.rb
test/unit/enumeration_test.rb
test/unit/filesystem_adapter_test.rb
test/unit/git_adapter_test.rb
test/unit/group_test.rb
test/unit/issue_category_test.rb
test/unit/issue_priority_test.rb
test/unit/issue_status_test.rb
test/unit/issue_test.rb
test/unit/journal_test.rb
test/unit/lib/redmine/access_control_test.rb
test/unit/lib/redmine/hook_test.rb
test/unit/lib/redmine/i18n_test.rb
test/unit/lib/redmine/mime_type_test.rb
test/unit/lib/redmine/plugin_test.rb
test/unit/lib/redmine/unified_diff_test.rb
test/unit/mail_handler_test.rb
test/unit/mailer_test.rb
test/unit/member_test.rb
test/unit/mercurial_adapter_test.rb
test/unit/message_test.rb
test/unit/news_test.rb
test/unit/project_test.rb
test/unit/query_test.rb
test/unit/repository_bazaar_test.rb
test/unit/repository_cvs_test.rb
test/unit/repository_darcs_test.rb
test/unit/repository_filesystem_test.rb
test/unit/repository_git_test.rb
test/unit/repository_mercurial_test.rb
test/unit/repository_subversion_test.rb
test/unit/repository_test.rb
test/unit/role_test.rb
test/unit/search_test.rb
test/unit/setting_test.rb
test/unit/subversion_adapter_test.rb
test/unit/time_entry_activity_test.rb
test/unit/time_entry_test.rb
test/unit/token_test.rb
test/unit/tracker_test.rb
test/unit/user_preference_test.rb
test/unit/user_test.rb
test/unit/version_test.rb
test/unit/watcher_test.rb
test/unit/wiki_content_test.rb
test/unit/wiki_page_test.rb
test/unit/wiki_redirect_test.rb
test/unit/wiki_test.rb
vendor/plugins/engines/Rakefile
vendor/plugins/engines/about.yml
vendor/plugins/engines/boot.rb
vendor/plugins/engines/init.rb
vendor/plugins/engines/lib/engines.rb
vendor/plugins/engines/lib/engines/plugin.rb
vendor/plugins/engines/lib/engines/plugin/loader.rb
vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb [deleted file]
vendor/plugins/engines/lib/engines/rails_extensions/routing.rb [deleted file]
vendor/plugins/engines/lib/engines/testing.rb
vendor/plugins/engines/tasks/engines.rake
vendor/plugins/engines/test/app/controllers/app_and_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/app/controllers/namespace/app_and_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/app/helpers/mail_helper.rb [new file with mode: 0644]
vendor/plugins/engines/test/app/models/app_and_plugin_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/app/models/notify_mail.rb [new file with mode: 0644]
vendor/plugins/engines/test/app/things/thing.rb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/app_and_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/namespace/app_and_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/notify_mail/implicit_multipart.text.plain.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/notify_mail/multipart_html.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/notify_mail/multipart_plain.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/notify_mail/signup.text.plain.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/plugin_mail/mail_from_plugin_with_application_template.text.plain.erb [new file with mode: 0644]
vendor/plugins/engines/test/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/functional/controller_loading_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/functional/exception_notification_compatibility_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/functional/locale_loading_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/functional/routes_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/functional/view_helpers_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/functional/view_loading_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/lib/app_and_plugin_lib_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/lib/engines_test_helper.rb [new file with mode: 0644]
vendor/plugins/engines/test/lib/render_information.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/alpha_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/app_and_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/alpha_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/app_and_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/namespace/shared_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/controllers/shared_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/models/alpha_plugin_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/models/app_and_plugin_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/models/shared_plugin_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/alpha_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/app_and_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/layouts/plugin_layout.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/alpha_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/app_and_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/namespace/shared_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/app/views/shared_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/lib/alpha_plugin_lib_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/lib/app_and_plugin_lib_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/alpha_plugin/locales/en.yml [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/app_and_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/namespace/shared_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/app/controllers/shared_plugin_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/app/models/shared_plugin_model.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/app/views/namespace/shared_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/app/views/shared_plugin/a_view.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/beta_plugin/locales/en.yml [new file with mode: 0644]
vendor/plugins/engines/test/plugins/not_a_plugin/public/should_not_be_copied.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets/app/controllers/assets_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets/app/views/assets/index.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets/app/views/layouts/assets.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets/public/file.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets/public/subfolder/file_in_subfolder.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/file.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/assets/subfolder/file_in_subfolder.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets_with_assets_directory/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/assets/file.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_assets_with_no_subdirectory/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_code_mixing/app/things/thing.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_code_mixing/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_load_path/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_migration/db/migrate/001_create_tests.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_migration/db/migrate/002_create_others.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_migration/db/migrate/003_create_extras.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_migration/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/app/models/plugin_mail.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/mail_from_plugin.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_html.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_plain.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_html.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/app/views/plugin_mail/multipart_from_plugin_with_application_template_plain.html.erb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_plugin_mailing/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_routing/app/controllers/namespace/test_routing_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_routing/app/controllers/test_routing_controller.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_routing/config/routes.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_routing/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_testing/app/README.txt [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_testing/init.rb [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_testing/test/fixtures/testing_fixtures.yml [new file with mode: 0644]
vendor/plugins/engines/test/plugins/test_testing/test/unit/override_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/action_mailer_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/assets_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/backwards_compat_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/load_path_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/migration_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/model_and_lib_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/plugins_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/test_testing/override_test.rb [new file with mode: 0644]
vendor/plugins/engines/test/unit/testing_test.rb [new file with mode: 0644]
vendor/plugins/prepend_engine_views/init.rb [new file with mode: 0644]

diff --git a/app/controllers/application.rb b/app/controllers/application.rb
deleted file mode 100644 (file)
index 6d6338f..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-# redMine - project management software
-# Copyright (C) 2006-2007  Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-require 'uri'
-require 'cgi'
-
-class ApplicationController < ActionController::Base
-  include Redmine::I18n
-  
-  # In case the cookie store secret changes
-  rescue_from CGI::Session::CookieStore::TamperedWithCookie do |exception|
-    render :text => 'Your session was invalid and has been reset. Please, reload this page.', :status => 500
-  end
-  
-  layout 'base'
-  
-  before_filter :user_setup, :check_if_login_required, :set_localization
-  filter_parameter_logging :password
-  
-  include Redmine::MenuManager::MenuController
-  helper Redmine::MenuManager::MenuHelper
-  
-  REDMINE_SUPPORTED_SCM.each do |scm|
-    require_dependency "repository/#{scm.underscore}"
-  end
-  
-  def user_setup
-    # Check the settings cache for each request
-    Setting.check_cache
-    # Find the current user
-    User.current = find_current_user
-  end
-  
-  # Returns the current user or nil if no user is logged in
-  # and starts a session if needed
-  def find_current_user
-    if session[:user_id]
-      # existing session
-      (User.active.find(session[:user_id]) rescue nil)
-    elsif cookies[:autologin] && Setting.autologin?
-      # auto-login feature starts a new session
-      user = User.try_to_autologin(cookies[:autologin])
-      session[:user_id] = user.id if user
-      user
-    elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
-      # RSS key authentication does not start a session
-      User.find_by_rss_key(params[:key])
-    end
-  end
-  
-  # Sets the logged in user
-  def logged_user=(user)
-    if user && user.is_a?(User)
-      User.current = user
-      session[:user_id] = user.id
-    else
-      User.current = User.anonymous
-      session[:user_id] = nil
-    end
-  end
-  
-  # check if login is globally required to access the application
-  def check_if_login_required
-    # no check needed if user is already logged in
-    return true if User.current.logged?
-    require_login if Setting.login_required?
-  end 
-  
-  def set_localization
-    lang = nil
-    if User.current.logged?
-      lang = find_language(User.current.language)
-    end
-    if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE']
-      accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase
-      if !accept_lang.blank?
-        lang = find_language(accept_lang) || find_language(accept_lang.split('-').first)
-      end
-    end
-    lang ||= Setting.default_language
-    set_language_if_valid(lang)
-  end
-  
-  def require_login
-    if !User.current.logged?
-      redirect_to :controller => "account", :action => "login", :back_url => url_for(params)
-      return false
-    end
-    true
-  end
-
-  def require_admin
-    return unless require_login
-    if !User.current.admin?
-      render_403
-      return false
-    end
-    true
-  end
-  
-  def deny_access
-    User.current.logged? ? render_403 : require_login
-  end
-
-  # Authorize the user for the requested action
-  def authorize(ctrl = params[:controller], action = params[:action], global = false)
-    allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)
-    allowed ? true : deny_access
-  end
-
-  # Authorize the user for the requested action outside a project
-  def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
-    authorize(ctrl, action, global)
-  end
-  
-  # make sure that the user is a member of the project (or admin) if project is private
-  # used as a before_filter for actions that do not require any particular permission on the project
-  def check_project_privacy
-    if @project && @project.active?
-      if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
-        true
-      else
-        User.current.logged? ? render_403 : require_login
-      end
-    else
-      @project = nil
-      render_404
-      false
-    end
-  end
-
-  def redirect_back_or_default(default)
-    back_url = CGI.unescape(params[:back_url].to_s)
-    if !back_url.blank?
-      begin
-        uri = URI.parse(back_url)
-        # do not redirect user to another host or to the login or register page
-        if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
-          redirect_to(back_url) and return
-        end
-      rescue URI::InvalidURIError
-        # redirect to default
-      end
-    end
-    redirect_to default
-  end
-  
-  def render_403
-    @project = nil
-    render :template => "common/403", :layout => !request.xhr?, :status => 403
-    return false
-  end
-    
-  def render_404
-    render :template => "common/404", :layout => !request.xhr?, :status => 404
-    return false
-  end
-  
-  def render_error(msg)
-    flash.now[:error] = msg
-    render :text => '', :layout => !request.xhr?, :status => 500
-  end
-  
-  def render_feed(items, options={})    
-    @items = items || []
-    @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
-    @items = @items.slice(0, Setting.feeds_limit.to_i)
-    @title = options[:title] || Setting.app_title
-    render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml'
-  end
-  
-  def self.accept_key_auth(*actions)
-    actions = actions.flatten.map(&:to_s)
-    write_inheritable_attribute('accept_key_auth_actions', actions)
-  end
-  
-  def accept_key_auth_actions
-    self.class.read_inheritable_attribute('accept_key_auth_actions') || []
-  end
-  
-  # TODO: move to model
-  def attach_files(obj, attachments)
-    attached = []
-    unsaved = []
-    if attachments && attachments.is_a?(Hash)
-      attachments.each_value do |attachment|
-        file = attachment['file']
-        next unless file && file.size > 0
-        a = Attachment.create(:container => obj, 
-                              :file => file,
-                              :description => attachment['description'].to_s.strip,
-                              :author => User.current)
-        a.new_record? ? (unsaved << a) : (attached << a)
-      end
-      if unsaved.any?
-        flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
-      end
-    end
-    attached
-  end
-
-  # Returns the number of objects that should be displayed
-  # on the paginated list
-  def per_page_option
-    per_page = nil
-    if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
-      per_page = params[:per_page].to_s.to_i
-      session[:per_page] = per_page
-    elsif session[:per_page]
-      per_page = session[:per_page]
-    else
-      per_page = Setting.per_page_options_array.first || 25
-    end
-    per_page
-  end
-
-  # qvalues http header parser
-  # code taken from webrick
-  def parse_qvalues(value)
-    tmp = []
-    if value
-      parts = value.split(/,\s*/)
-      parts.each {|part|
-        if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
-          val = m[1]
-          q = (m[2] or 1).to_f
-          tmp.push([val, q])
-        end
-      }
-      tmp = tmp.sort_by{|val, q| -q}
-      tmp.collect!{|val, q| val}
-    end
-    return tmp
-  rescue
-    nil
-  end
-  
-  # Returns a string that can be used as filename value in Content-Disposition header
-  def filename_for_content_disposition(name)
-    request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
-  end
-end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
new file mode 100644 (file)
index 0000000..59d117e
--- /dev/null
@@ -0,0 +1,251 @@
+# redMine - project management software
+# Copyright (C) 2006-2007  Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+require 'uri'
+require 'cgi'
+
+class ApplicationController < ActionController::Base
+  include Redmine::I18n
+
+  layout 'base'
+  
+  before_filter :user_setup, :check_if_login_required, :set_localization
+  filter_parameter_logging :password
+  
+  include Redmine::MenuManager::MenuController
+  helper Redmine::MenuManager::MenuHelper
+  
+  REDMINE_SUPPORTED_SCM.each do |scm|
+    require_dependency "repository/#{scm.underscore}"
+  end
+  
+  def user_setup
+    # Check the settings cache for each request
+    Setting.check_cache
+    # Find the current user
+    User.current = find_current_user
+  end
+  
+  # Returns the current user or nil if no user is logged in
+  # and starts a session if needed
+  def find_current_user
+    if session[:user_id]
+      # existing session
+      (User.active.find(session[:user_id]) rescue nil)
+    elsif cookies[:autologin] && Setting.autologin?
+      # auto-login feature starts a new session
+      user = User.try_to_autologin(cookies[:autologin])
+      session[:user_id] = user.id if user
+      user
+    elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
+      # RSS key authentication does not start a session
+      User.find_by_rss_key(params[:key])
+    end
+  end
+  
+  # Sets the logged in user
+  def logged_user=(user)
+    if user && user.is_a?(User)
+      User.current = user
+      session[:user_id] = user.id
+    else
+      User.current = User.anonymous
+      session[:user_id] = nil
+    end
+  end
+  
+  # check if login is globally required to access the application
+  def check_if_login_required
+    # no check needed if user is already logged in
+    return true if User.current.logged?
+    require_login if Setting.login_required?
+  end 
+  
+  def set_localization
+    lang = nil
+    if User.current.logged?
+      lang = find_language(User.current.language)
+    end
+    if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE']
+      accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase
+      if !accept_lang.blank?
+        lang = find_language(accept_lang) || find_language(accept_lang.split('-').first)
+      end
+    end
+    lang ||= Setting.default_language
+    set_language_if_valid(lang)
+  end
+  
+  def require_login
+    if !User.current.logged?
+      redirect_to :controller => "account", :action => "login", :back_url => url_for(params)
+      return false
+    end
+    true
+  end
+
+  def require_admin
+    return unless require_login
+    if !User.current.admin?
+      render_403
+      return false
+    end
+    true
+  end
+  
+  def deny_access
+    User.current.logged? ? render_403 : require_login
+  end
+
+  # Authorize the user for the requested action
+  def authorize(ctrl = params[:controller], action = params[:action], global = false)
+    allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)
+    allowed ? true : deny_access
+  end
+
+  # Authorize the user for the requested action outside a project
+  def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
+    authorize(ctrl, action, global)
+  end
+  
+  # make sure that the user is a member of the project (or admin) if project is private
+  # used as a before_filter for actions that do not require any particular permission on the project
+  def check_project_privacy
+    if @project && @project.active?
+      if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
+        true
+      else
+        User.current.logged? ? render_403 : require_login
+      end
+    else
+      @project = nil
+      render_404
+      false
+    end
+  end
+
+  def redirect_back_or_default(default)
+    back_url = CGI.unescape(params[:back_url].to_s)
+    if !back_url.blank?
+      begin
+        uri = URI.parse(back_url)
+        # do not redirect user to another host or to the login or register page
+        if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
+          redirect_to(back_url) and return
+        end
+      rescue URI::InvalidURIError
+        # redirect to default
+      end
+    end
+    redirect_to default
+  end
+  
+  def render_403
+    @project = nil
+    render :template => "common/403", :layout => !request.xhr?, :status => 403
+    return false
+  end
+    
+  def render_404
+    render :template => "common/404", :layout => !request.xhr?, :status => 404
+    return false
+  end
+  
+  def render_error(msg)
+    flash.now[:error] = msg
+    render :text => '', :layout => !request.xhr?, :status => 500
+  end
+  
+  def render_feed(items, options={})    
+    @items = items || []
+    @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
+    @items = @items.slice(0, Setting.feeds_limit.to_i)
+    @title = options[:title] || Setting.app_title
+    render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml'
+  end
+  
+  def self.accept_key_auth(*actions)
+    actions = actions.flatten.map(&:to_s)
+    write_inheritable_attribute('accept_key_auth_actions', actions)
+  end
+  
+  def accept_key_auth_actions
+    self.class.read_inheritable_attribute('accept_key_auth_actions') || []
+  end
+  
+  # TODO: move to model
+  def attach_files(obj, attachments)
+    attached = []
+    unsaved = []
+    if attachments && attachments.is_a?(Hash)
+      attachments.each_value do |attachment|
+        file = attachment['file']
+        next unless file && file.size > 0
+        a = Attachment.create(:container => obj, 
+                              :file => file,
+                              :description => attachment['description'].to_s.strip,
+                              :author => User.current)
+        a.new_record? ? (unsaved << a) : (attached << a)
+      end
+      if unsaved.any?
+        flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
+      end
+    end
+    attached
+  end
+
+  # Returns the number of objects that should be displayed
+  # on the paginated list
+  def per_page_option
+    per_page = nil
+    if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
+      per_page = params[:per_page].to_s.to_i
+      session[:per_page] = per_page
+    elsif session[:per_page]
+      per_page = session[:per_page]
+    else
+      per_page = Setting.per_page_options_array.first || 25
+    end
+    per_page
+  end
+
+  # qvalues http header parser
+  # code taken from webrick
+  def parse_qvalues(value)
+    tmp = []
+    if value
+      parts = value.split(/,\s*/)
+      parts.each {|part|
+        if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
+          val = m[1]
+          q = (m[2] or 1).to_f
+          tmp.push([val, q])
+        end
+      }
+      tmp = tmp.sort_by{|val, q| -q}
+      tmp.collect!{|val, q| val}
+    end
+    return tmp
+  rescue
+    nil
+  end
+  
+  # Returns a string that can be used as filename value in Content-Disposition header
+  def filename_for_content_disposition(name)
+    request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
+  end
+end
index 938ace9bab6f42adfdf370f5f96976d884f5483d..42405468fbbd7169496ee2bf18ec046a3128de04 100644 (file)
@@ -259,7 +259,7 @@ private
 
   def graph_commits_per_author(repository)
     commits_by_author = repository.changesets.count(:all, :group => :committer)
-    commits_by_author.sort! {|x, y| x.last <=> y.last}
+    commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}
 
     changes_by_author = repository.changes.count(:all, :group => :committer)
     h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
index fbe76ac3aa5bc103e07db55e475ed145e85d31b3..1a2e35e7d3105b06a7ddf38358c30abf3c8fa32f 100644 (file)
@@ -16,6 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 class Mailer < ActionMailer::Base
+  layout 'mailer'
   helper :application
   helper :issues
   helper :custom_fields
@@ -45,6 +46,7 @@ class Mailer < ActionMailer::Base
     subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
     body :issue => issue,
          :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
+    render_multipart('issue_add', body)
   end
 
   # Builds a tmail object used to email recipients of the edited issue.
@@ -71,6 +73,8 @@ class Mailer < ActionMailer::Base
     body :issue => issue,
          :journal => journal,
          :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
+
+    render_multipart('issue_edit', body)
   end
 
   def reminder(user, issues, days)
@@ -80,6 +84,7 @@ class Mailer < ActionMailer::Base
     body :issues => issues,
          :days => days,
          :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'due_date', :sort_order => 'asc')
+    render_multipart('reminder', body)
   end
 
   # Builds a tmail object used to email users belonging to the added document's project.
@@ -93,6 +98,7 @@ class Mailer < ActionMailer::Base
     subject "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
     body :document => document,
          :document_url => url_for(:controller => 'documents', :action => 'show', :id => document)
+    render_multipart('document_added', body)
   end
 
   # Builds a tmail object used to email recipients of a project when an attachements are added.
@@ -121,6 +127,7 @@ class Mailer < ActionMailer::Base
     body :attachments => attachments,
          :added_to => added_to,
          :added_to_url => added_to_url
+    render_multipart('attachments_added', body)
   end
   
   # Builds a tmail object used to email recipients of a news' project when a news item is added.
@@ -135,6 +142,7 @@ class Mailer < ActionMailer::Base
     subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}"
     body :news => news,
          :news_url => url_for(:controller => 'news', :action => 'show', :id => news)
+    render_multipart('news_added', body)
   end
 
   # Builds a tmail object used to email the specified recipients of the specified message that was posted. 
@@ -151,6 +159,7 @@ class Mailer < ActionMailer::Base
     subject "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}"
     body :message => message,
          :message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root)
+    render_multipart('message_posted', body)
   end
   
   # Builds a tmail object used to email the recipients of a project of the specified wiki content was added. 
@@ -167,6 +176,7 @@ class Mailer < ActionMailer::Base
     subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
     body :wiki_content => wiki_content,
          :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title)
+    render_multipart('wiki_content_added', body)
   end
   
   # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated. 
@@ -184,6 +194,7 @@ class Mailer < ActionMailer::Base
     body :wiki_content => wiki_content,
          :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
          :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', :id => wiki_content.project, :page => wiki_content.page.title, :version => wiki_content.version)
+    render_multipart('wiki_content_updated', body)
   end
 
   # Builds a tmail object used to email the specified user their account information.
@@ -198,6 +209,7 @@ class Mailer < ActionMailer::Base
     body :user => user,
          :password => password,
          :login_url => url_for(:controller => 'account', :action => 'login')
+    render_multipart('account_information', body)
   end
 
   # Builds a tmail object used to email all active administrators of an account activation request.
@@ -211,6 +223,7 @@ class Mailer < ActionMailer::Base
     subject l(:mail_subject_account_activation_request, Setting.app_title)
     body :user => user,
          :url => url_for(:controller => 'users', :action => 'index', :status => User::STATUS_REGISTERED, :sort_key => 'created_on', :sort_order => 'desc')
+    render_multipart('account_activation_request', body)
   end
 
   # Builds a tmail object used to email the specified user that their account was activated by an administrator.
@@ -224,6 +237,7 @@ class Mailer < ActionMailer::Base
     subject l(:mail_subject_register, Setting.app_title)
     body :user => user,
          :login_url => url_for(:controller => 'account', :action => 'login')
+    render_multipart('account_activated', body)
   end
 
   def lost_password(token)
@@ -232,6 +246,7 @@ class Mailer < ActionMailer::Base
     subject l(:mail_subject_lost_password, Setting.app_title)
     body :token => token,
          :url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value)
+    render_multipart('lost_password', body)
   end
 
   def register(token)
@@ -240,6 +255,7 @@ class Mailer < ActionMailer::Base
     subject l(:mail_subject_register, Setting.app_title)
     body :token => token,
          :url => url_for(:controller => 'account', :action => 'activate', :token => token.value)
+    render_multipart('register', body)
   end
 
   def test(user)
@@ -247,6 +263,7 @@ class Mailer < ActionMailer::Base
     recipients user.mail
     subject 'Redmine test'
     body :url => url_for(:controller => 'welcome')
+    render_multipart('test', body)
   end
 
   # Overrides default deliver! method to prevent from sending an email
@@ -327,26 +344,17 @@ class Mailer < ActionMailer::Base
     super
   end
 
-  # Renders a message with the corresponding layout
-  def render_message(method_name, body)
-    layout = method_name.to_s.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml'
-    body[:content_for_layout] = render(:file => method_name, :body => body)
-    ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true)
-  end
-
-  # for the case of plain text only
-  def body(*params)
-    value = super(*params)
-    if Setting.plain_text_mail?
-      templates = Dir.glob("#{template_path}/#{@template}.text.plain.{rhtml,erb}")
-      unless String === @body or templates.empty?
-        template = File.basename(templates.first)
-        @body[:content_for_layout] = render(:file => template, :body => @body)
-        @body = ActionView::Base.new(template_root, @body, self).render(:file => "mailer/layout.text.plain.rhtml", :use_full_path => true)
-        return @body
-      end
-    end
-    return value
+  # Rails 2.3 has problems rendering implicit multipart messages with
+  # layouts so this method will wrap an multipart messages with
+  # explicit parts.
+  #
+  # https://rails.lighthouseapp.com/projects/8994/tickets/2338-actionmailer-mailer-views-and-content-type
+  # https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts
+  
+  def render_multipart(method_name, body)
+    content_type "multipart/alternative"
+    part :content_type => "text/plain", :body => render(:file => "#{method_name}.text.plain.rhtml", :body => body, :layout => 'mailer.text.plain.erb')
+    part :content_type => "text/html", :body => render_message("#{method_name}.text.html.rhtml", body) unless Setting.plain_text_mail?
   end
 
   # Makes partial rendering work with Rails 1.2 (retro-compatibility)
diff --git a/app/views/layouts/mailer.text.html.erb b/app/views/layouts/mailer.text.html.erb
new file mode 100644 (file)
index 0000000..83d9678
--- /dev/null
@@ -0,0 +1,32 @@
+<html>
+<head>
+<style>
+body {
+  font-family: Verdana, sans-serif;
+  font-size: 0.8em;
+  color:#484848;
+}
+h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin: 0px; }
+h1 { font-size: 1.2em; }
+h2, h3 { font-size: 1.1em; }
+a, a:link, a:visited { color: #2A5685;}
+a:hover, a:active { color: #c61a1a; }
+a.wiki-anchor { display: none; }
+hr {
+  width: 100%;
+  height: 1px;
+  background: #ccc;
+  border: 0;
+}
+.footer {
+  font-size: 0.8em;
+  font-style: italic;
+}
+</style>
+</head>
+<body>
+<%= yield %>
+<hr />
+<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer) %></span>
+</body>
+</html>
diff --git a/app/views/layouts/mailer.text.plain.erb b/app/views/layouts/mailer.text.plain.erb
new file mode 100644 (file)
index 0000000..1cbcbc2
--- /dev/null
@@ -0,0 +1,3 @@
+<%= yield %>
+-- 
+<%= Setting.emails_footer %>
diff --git a/app/views/mailer/layout.text.html.rhtml b/app/views/mailer/layout.text.html.rhtml
deleted file mode 100644 (file)
index 83d9678..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<html>
-<head>
-<style>
-body {
-  font-family: Verdana, sans-serif;
-  font-size: 0.8em;
-  color:#484848;
-}
-h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin: 0px; }
-h1 { font-size: 1.2em; }
-h2, h3 { font-size: 1.1em; }
-a, a:link, a:visited { color: #2A5685;}
-a:hover, a:active { color: #c61a1a; }
-a.wiki-anchor { display: none; }
-hr {
-  width: 100%;
-  height: 1px;
-  background: #ccc;
-  border: 0;
-}
-.footer {
-  font-size: 0.8em;
-  font-style: italic;
-}
-</style>
-</head>
-<body>
-<%= yield %>
-<hr />
-<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer) %></span>
-</body>
-</html>
diff --git a/app/views/mailer/layout.text.plain.rhtml b/app/views/mailer/layout.text.plain.rhtml
deleted file mode 100644 (file)
index 1cbcbc2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= yield %>
--- 
-<%= Setting.emails_footer %>
index 25d344da6a29ae9714e92f2a28d8a28465831af8..f4b8dbf52c493c4d0f5b974e43db29929b491aa9 100644 (file)
@@ -2,7 +2,9 @@
 
 <div class="box tabular settings">
 <p><label><%= l(:setting_login_required) %></label>
-<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p>
+<%= hidden_field_tag 'settings[login_required]', 0 %>
+<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %>
+</p>
 
 <p><label><%= l(:setting_autologin) %></label>
 <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, Setting.autologin) %></p>
 <%= text_field_tag 'settings[password_min_length]', Setting.password_min_length, :size => 6 %></p>
 
 <p><label><%= l(:label_password_lost) %></label>
-<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
+<%= hidden_field_tag 'settings[lost_password]', 0 %>
+<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %>
+</p>
 
 <p><label><%= l(:setting_openid) %></label>
-<%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %><%= hidden_field_tag 'settings[openid]', 0 %></p>
+<%= hidden_field_tag 'settings[openid]', 0 %>
+<%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %>
+</p>
 </div>
 
 <div style="float:right;">
index a14ff47ce440bea668741b0398d5cabc180ba081..984f762e4ce34bf46ac241f7b2cfdc8311cd733f 100644 (file)
@@ -17,7 +17,9 @@
 <%= select_tag 'settings[user_format]', options_for_select( @options[:user_format], Setting.user_format.to_s ) %></p>
 
 <p><label><%= l(:setting_gravatar_enabled) %></label>
-<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p>
+<%= hidden_field_tag 'settings[gravatar_enabled]', 0 %>
+<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %>
+</p>
 </div>
 
 <%= submit_tag l(:button_save) %>
index 0703661e09715e59dd9c2d81f215c5693f1f4450..b0277fab3a62d0ddba47bf6419757b8d7b2937e9 100644 (file)
@@ -2,10 +2,14 @@
 
 <div class="box tabular settings">
 <p><label><%= l(:setting_cross_project_issue_relations) %></label>
-<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p>
+<%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %>
+<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %>
+</p>
 
 <p><label><%= l(:setting_display_subprojects_issues) %></label>
-<%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %><%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %></p>
+<%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %>
+<%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %>
+</p>
 
 <p><label><%= l(:setting_issues_export_limit) %></label>
 <%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
index 830b1ba4a5d3aa2c9f61d20dff6c0e016bf58d3e..8d83358b76ca8b91f0246817143fbbb200bc5dc3 100644 (file)
@@ -2,9 +2,10 @@
 
 <div class="box tabular settings">
 <p><label><%= l(:setting_mail_handler_api_enabled) %></label>
+<%= hidden_field_tag 'settings[mail_handler_api_enabled]', 0 %>
 <%= check_box_tag 'settings[mail_handler_api_enabled]', 1, Setting.mail_handler_api_enabled?,
                   :onclick => "if (this.checked) { Form.Element.enable('settings_mail_handler_api_key'); } else { Form.Element.disable('settings_mail_handler_api_key'); }" %>
-<%= hidden_field_tag 'settings[mail_handler_api_enabled]', 0 %></p>
+</p>
 
 <p><label><%= l(:setting_mail_handler_api_key) %></label>
 <%= text_field_tag 'settings[mail_handler_api_key]', Setting.mail_handler_api_key, 
index bc014118729025ef05149408c67e8674e80fad98..1b1b294b2abd2fa0b52a0564bdba7973702ee791 100644 (file)
@@ -6,12 +6,14 @@
 <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
 
 <p><label><%= l(:setting_bcc_recipients) %></label>
+<%= hidden_field_tag 'settings[bcc_recipients]', 0 %>
 <%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %>
-<%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p>
+</p>
 
 <p><label><%= l(:setting_plain_text_mail) %></label>
+<%= hidden_field_tag 'settings[plain_text_mail]', 0 %>
 <%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %>
-<%= hidden_field_tag 'settings[plain_text_mail]', 0 %></p>
+</p>
 </div>
 
 <fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
index 2f831c8fdce040ccd325739a86480cea2a99c931..704905af2711defd9ee9a082859b1b5c94aea61d 100644 (file)
@@ -2,10 +2,14 @@
 
 <div class="box tabular settings">
 <p><label><%= l(:setting_default_projects_public) %></label>
-<%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p>
+<%= hidden_field_tag 'settings[default_projects_public]', 0 %>
+<%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %>
+</p>
 
 <p><label><%= l(:setting_sequential_project_identifiers) %></label>
-<%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %></p>
+<%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %>
+<%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %>
+</p>
 
 <p><label><%= l(:setting_new_project_user_role_id) %></label>
 <%= select_tag('settings[new_project_user_role_id]', options_for_select([["--- #{l(:actionview_instancetag_blank_option)} ---", '']] + Role.find_all_givable.collect {|r| [r.name, r.id]}, Setting.new_project_user_role_id.to_i)) %></p>
index a20fc51318604e0acd81b539cf6fc9d3a38a0d27..4f07f053abe0f9e27e4dbd71fdf0ae190d304a06 100644 (file)
@@ -2,10 +2,14 @@
 
 <div class="box tabular settings">
 <p><label><%= l(:setting_autofetch_changesets) %></label>
-<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p>
+<%= hidden_field_tag 'settings[autofetch_changesets]', 0 %>
+<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %>
+</p>
 
 <p><label><%= l(:setting_sys_api_enabled) %></label>
-<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p>
+<%= hidden_field_tag 'settings[sys_api_enabled]', 0 %>
+<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %>
+</p>
 
 <p><label><%= l(:setting_enabled_scm) %></label>
 <% REDMINE_SUPPORTED_SCM.each do |scm| -%>
index 67cc517f21324185cc5c7ee7996e608b62d1405b..dd5e3b69164003253fb4e7ddd153d210584ec2da 100644 (file)
@@ -1,7 +1,7 @@
 # Don't change this file!
 # Configure your app in config/environment.rb and config/environments/*.rb
 
-RAILS_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..") unless defined?(RAILS_ROOT)
+RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
 
 module Rails
   class << self
@@ -44,6 +44,7 @@ module Rails
     def load_initializer
       require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
       Rails::Initializer.run(:install_gem_spec_stubs)
+      Rails::GemDependency.add_frozen_gem_path
     end
   end
 
@@ -81,8 +82,8 @@ module Rails
       end
 
       def load_rubygems
+        min_version = '1.3.2'
         require 'rubygems'
-        min_version = '1.3.1'
         unless rubygems_version >= min_version
           $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
           exit 1
index f98968bcb43cd8af96d43f920a973d5538291484..d173db4120a960b3a1f7a99ac6df28c4418f5c4b 100644 (file)
@@ -5,7 +5,7 @@
 # ENV['RAILS_ENV'] ||= 'production'
 
 # Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
 
 # Bootstrap the Rails environment, frameworks, and default configuration
 require File.join(File.dirname(__FILE__), 'boot')
index f4ae06cd633d4a3bce560979ff727dbc281a59d8..94d40faaf21256a3af7f10b914678926da815f99 100644 (file)
@@ -33,7 +33,7 @@ module ActiveRecord
             end
           else
             attr_name = @base.class.human_attribute_name(attr)
-            full_messages << attr_name + ' ' + message
+            full_messages << attr_name + ' ' + message.to_s
           end
         end
       end
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
new file mode 100644 (file)
index 0000000..c2169ed
--- /dev/null
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
\ No newline at end of file
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
new file mode 100644 (file)
index 0000000..d531b8b
--- /dev/null
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format 
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+#   inflect.plural /^(ox)$/i, '\1en'
+#   inflect.singular /^(ox)en/i, '\1'
+#   inflect.irregular 'person', 'people'
+#   inflect.uncountable %w( fish sheep )
+# end
index e83c5d89368a8d3f672638f0aba75f9cc3e796a3..a66a86bf39aa118f6bcb5d4bed71576be7176471 100644 (file)
@@ -59,6 +59,22 @@ bg:
       over_x_years:
         one:   "over 1 year"
         other: "over {{count}} years"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: 'MB'
       
 # Used in array.to_sentence.
   support:
index c03b5aeccb6f9ed299d718bcf4101f18df0f9467..0a5536bdc7d2f00b94fb8f379320e5cf1fa9f79c 100644 (file)
@@ -83,9 +83,16 @@ bs:
       format:
         delimiter: ""
         precision: 1
-
-
-
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
         
 # Used in array.to_sentence.
   support:
index 45f4a644f7dbd014a779669fa394029511d9ecd8..7315b1cd684a92a0e45c7d3d25a09aee81b3dcd2 100644 (file)
@@ -59,6 +59,22 @@ ca:
       over_x_years:
         one:   "més d'un any"
         other: "més de {{count}} anys"
+
+  number:
+    human:
+      format:
+        delimiter: ""
+        precision: 1
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
         
 # Used in array.to_sentence.
   support:
index 087da5fbedf30b1ca9ecad6f6cc3b0f6f6def77f..59e1b95f99146a52c112275d46558067d592b9f8 100644 (file)
@@ -59,6 +59,22 @@ cs:
       over_x_years:
         one:   "více než 1 rok"
         other: "více než {{count}} roky"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index ec0386ab5ec662d5935022ef056ae185ba78a123..2453ec9ab51bff49d7cc4c8efb4b6b472f4bc772 100644 (file)
@@ -85,7 +85,16 @@ da:
         # separator: 
         delimiter: ""
         precision: 1
-      storage_units: [Bytes, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
     percentage:
       format:
         # separator:
index da3e8935c595449e989b940e24b1f5445380b6e6..da700a6e469606048bf073b607948ccc160dcb3c 100644 (file)
@@ -83,6 +83,16 @@ de:
       format:
         delimiter: ""
         precision: 1
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   support:
     array:
index 8e20ed5c09cf957595157f6e88148b26300f3601..479b440d4bee057a2f312fd19c2d8bfb8f8a261c 100644 (file)
@@ -63,6 +63,22 @@ el:
         one:   "πάνω από 1 χρόνο"
         other: "πάνω από {{count}} χρόνια"
         
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
+
 # Used in array.to_sentence.
   support:
     array:
index 190a6d797b519bd7f4c9948dbc53204e43cdeae2..0b30843e9365728bc56cfb9b3133c9fb12c6d5d0 100644 (file)
@@ -59,6 +59,23 @@ en:
       over_x_years:
         one:   "over 1 year"
         other: "over {{count}} years"
+
+  number:
+    human:
+      format:
+        delimiter: ""
+        precision: 1
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
+
         
 # Used in array.to_sentence.
   support:
index af21eeff3efcf0ed4e7425512c7e75f096e93e0b..fd1a6405db237dffd9b60e54a691a47340a8ca26 100644 (file)
@@ -47,6 +47,16 @@ es:
         # separator: 
         delimiter: "" 
         precision: 1
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
   datetime:
index 2a67e72435634164ab73c6d085e6679cab3c981b..b0e00b00cca6b6ebc799420db428739bb52d743d 100644 (file)
@@ -61,7 +61,16 @@ fi:
       format:
         delimiter: ""
         precision: 1
-      storage_units: [Tavua, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Tavua"
+            other: "Tavua"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
  
   datetime:
     distance_in_words:
index 7eb0f062b306efc92c3178d79696fdae83620f68..e6231e8ef6afe7929b1899a0b2d75184b6337417 100644 (file)
@@ -84,7 +84,16 @@ fr:
     human:
       format:
         precision: 2
-      storage_units: [ Octet, ko, Mo, Go, To ]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Octet"
+            other: "Octet"
+          kb: "ko"
+          mb: "Mo"
+          gb: "Go"
+          tb: "To"
   
   support:
     array:
index 55bcd0b44bcb996f7d32e6973cc1ef8317f7cc2a..f8aab4b1ebe88b5f71fa1a8c8f0d632640812772 100644 (file)
@@ -33,6 +33,16 @@ gl:
         # separator: 
         delimiter: "" 
         precision: 1
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
   
   
   date:
index 423ebfbd584a5f428b4a49d88fa9a1bb358a9929..8124ddac0d86028415dc4738669c933022fa1e8f 100644 (file)
@@ -76,6 +76,17 @@ he:
         unit: 'שח'
         precision: 2
         format: '%u %n'
+    human:
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
         
   support:
     array:
index 4d45005460e3d9381e43c85b10e2127894f01908..58fa750491b66a6293283bba9c3ad7766f5f2da8 100644 (file)
       format:
         delimiter: ""
         precision: 1
-      storage_units: [bájt, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "bájt"
+            other: "bájt"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   support:
     array:
index 5cb022fbed0f116d42f13ab19ee53cbb889c7eb2..64d5daf8616ffd861fde0021a689eb3f110ec9e6 100644 (file)
@@ -74,6 +74,17 @@ it:
         unit: '€'
         precision: 2
         format: '%n %u'
+    human:
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
         
   support:
     array:
index 0bc521fc3ac9a5a8ed181f787b34f92c6d85e778..107f84a3395bdf1b15a0bf5131b114a63ea30ccd 100644 (file)
@@ -96,6 +96,16 @@ ja:
       format:
         delimiter: ""
         precision: 1
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   activerecord:
     errors:
index e2e01cb99df0f581bb54a61b19a6dacab026f2f4..7b06e4ac795c9557648d543bdbf6e0a985e73473 100644 (file)
@@ -116,7 +116,16 @@ ko:
         # separator: 
         delimiter: ""
         precision: 1
-      storage_units: [Bytes, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
 # Used in array.to_sentence.
   support:
index 050fc1ce1c00e0806049ce5544bc7dca77cde668..2c27f50cd222ea3ffa6d126b0e4660090e32e2bc 100644 (file)
@@ -28,7 +28,16 @@ lt:
       format:
         delimiter: ""
         precision: 1
-      storage_units: [baitai, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "baitai"
+            other: "baitai"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   datetime:
     distance_in_words:
index 4f858aba8d5f44246ea23e86e7216c0df87d5e8e..a53f76720457a1079722dd878913f18bd40cdda2 100644 (file)
@@ -59,6 +59,22 @@ nl:
       over_x_years:
         one:   "over 1 jaar"
         other: "over {{count}} jaren"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index 82b9d3252abcb7059d9d414991dee1059d387b97..fddcc2f946776b3a4d4f0dcee08c452d3d129fb1 100644 (file)
       format:
         delimiter: ""
         precision: 4
+    human:
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
+
   activerecord:
     errors:
       template:
index 77850cae077cf737740489fde82ee196258dc4fa..d7e4849b36ee0d4406ea77f6f4d5aa649c27bc98 100644 (file)
@@ -21,7 +21,16 @@ pl:
       format:
         delimiter: ""
         precision: 1
-      storage_units: [B, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "B"
+            other: "B"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   date:
     formats:
index 578c4fa4eefd6f8ad940ed63f3e79a0c260425b3..23e571819c84147be3e132a7859bbef9bce9ce9a 100644 (file)
@@ -93,6 +93,16 @@ pt-BR:
       format:
         precision: 1
         delimiter: '.'
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
   support:
     array:
       sentence_connector: "e"
index 20b5b5330b39c2874201c5b7710fc7e1a14caf63..1c444f674512c1fbbe1ac72dabb56efd5a2c886b 100644 (file)
@@ -83,6 +83,16 @@ pt:
       format:
         precision: 1
         delimiter: ''
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   activerecord:
     errors:
index dde7dace30a479d03204e6fafb17df78577728ef..04eb98548ee4831b838a7b6bee90f0f599260925 100644 (file)
@@ -57,6 +57,22 @@ ro:
       over_x_years:
         one:   "peste un an"
         other: "peste {{count}} ani"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index feb870d3e1bdb8b87a3b72338b9d5bd7cc89cde2..6f3a641dcac029e0d876bd99c4cf198bd970dd7a 100644 (file)
@@ -59,6 +59,22 @@ sk:
       over_x_years:
         one:   "cez 1 rok"
         other: "cez {{count}} roky/ov"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index d7434b99f1fc6431d092f7b7d4a128767354fcb9..6881ac9c56d9b70f974b073b32d44894afdefca3 100644 (file)
@@ -59,6 +59,22 @@ sl:
       over_x_years:
         one:   "over 1 year"
         other: "over {{count}} years"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index c8aa7c26c180f6547cffdbf4b067051841804915..1edc4e1f012f185dc270486556bd9a0500f5e9de 100644 (file)
         unit: 'ДИН'
         precision: 2
         format: '%n %u'
+    human:
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   support:
     array:
index d007017f33294c6e3bf9570193ab7e568c62e556..f17c64d09bb55b4f339f0df8f7a37ffef6d3ceec 100644 (file)
@@ -47,7 +47,16 @@ sv:
         # separator: 
         delimiter: ""
         # precision: 1
-      storage_units: [Byte, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
   datetime:
index 49d55940daf84f1ebb89263616772e1a89d62de2..98d3c3c2bf72527955b68de504136a2ad579dce2 100644 (file)
@@ -59,6 +59,22 @@ th:
       over_x_years:
         one:   "over 1 year"
         other: "over {{count}} years"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index f7f57b134fb0ebf82c9fd578d6789c860b0c5819..d721eeb8f4c3075b3311487da44e4beb3048034f 100644 (file)
@@ -92,6 +92,16 @@ tr:
         delimiter: '.'
         separator: ','
         precision: 2
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   support:
     array:
index dbb085d6e2db75d4deef9732b091c192593b8e70..8209cc4fcfad050e2fb672689dc37aeeb98d923d 100644 (file)
@@ -59,6 +59,22 @@ uk:
       over_x_years:
         one:   "over 1 year"
         other: "over {{count}} years"
+
+  number: 
+    human: 
+      format: 
+        precision: 1
+        delimiter: ""
+      storage_units: 
+        format: "%n %u"
+        units: 
+          kb: KB
+          tb: TB
+          gb: GB
+          byte: 
+            one: Byte
+            other: Bytes
+          mb: MB
         
 # Used in array.to_sentence.
   support:
index 383d1953f8eb5c380f42ddeaf6ac4e62a07eabcb..69524197f01497149b617d5a30ebc287a83e3cee 100644 (file)
@@ -49,7 +49,16 @@ vi:
         # separator:
         delimiter: ""
         precision: 1
-      storage_units: [Bytes, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
 
   # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
   datetime:
index 4068b3c88b7c5180e9a3af3150d0b73faac39214..e9199c3d5eaf0ef91b411ab085fb6dd859800f1b 100644 (file)
@@ -86,8 +86,9 @@
         precision: 1
         # 儲存單位輸出格式.
         # %u 是儲存單位, %n 是數值 (預設值: 2 MB)
+      storage_units:
         format: "%n %u"
-        storage_units:
+        units:
           byte:
             one: "位元組 (B)"
             other: "位元組 (B)"
index b55462284a15a960ba9e5602c87d0850f0a082ac..a064828b4b0de828590a6fa79ef15fc270c37f22 100644 (file)
@@ -86,7 +86,16 @@ zh:
       format:
         delimiter: ""
         precision: 1
-      storage_units: [Bytes, KB, MB, GB, TB]
+      storage_units:
+        format: "%n %u"
+        units:
+          byte:
+            one: "Byte"
+            other: "Bytes"
+          kb: "KB"
+          mb: "MB"
+          gb: "GB"
+          tb: "TB"
   
   support:
     array:
index 5357fc30f5fc4781666b51618d2e188cc8f164c1..3b790af1464c47f7f95c538b8b3e591bc4d3ff79 100644 (file)
@@ -6,11 +6,6 @@ ActionController::Routing::Routes.draw do |map|
   # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
   # Keep in mind you can assign values other than :controller and :action
 
-  # Allow Redmine plugins to map routes and potentially override them
-  Rails.plugins.each do |plugin|
-    map.from_plugin plugin.name.to_sym
-  end
-
   map.home '', :controller => 'welcome'
   
   map.signin 'login', :controller => 'account', :action => 'login'
index 5bf690bd4a7a55c15c282b0e83027464cc5bee9e..8728266ba02352d8a5e4f38ea756b6af75269479 100644 (file)
@@ -43,7 +43,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
       return '' if options.delete(:no_label)
       text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label]
       text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym)
-      text << @template.content_tag("span", " *", :class => "required") if options.delete(:required)
+      text += @template.content_tag("span", " *", :class => "required") if options.delete(:required)
       @template.content_tag("label", text, 
                                      :class => (@object && @object.errors[field] ? "error" : nil), 
                                      :for => (@object_name.to_s + "_" + field.to_s))
index fb23e6bb7baf697e306b0703cb8c1b7939798606..8184fa312392c7b4a823e8930303cc8e31f9a14f 100644 (file)
@@ -21,7 +21,7 @@ require 'account_controller'
 # Re-raise errors caught by the controller.
 class AccountController; def rescue_action(e) raise e end; end
 
-class AccountControllerTest < Test::Unit::TestCase
+class AccountControllerTest < ActionController::TestCase
   fixtures :users, :roles
   
   def setup
index 32965de4c9219f11fef741363f2e3b466162f3ee..47091c42f8c405f36fd259b3f11a4e11c89a061e 100644 (file)
@@ -21,7 +21,7 @@ require 'admin_controller'
 # Re-raise errors caught by the controller.
 class AdminController; def rescue_action(e) raise e end; end
 
-class AdminControllerTest < Test::Unit::TestCase
+class AdminControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles
   
   def setup
index 0232b6a4df5f990861efdfce32d65bb026f9da88..7e221c2521bfa04bbbbcd1f5d6e276426370f909 100644 (file)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 require File.dirname(__FILE__) + '/../test_helper'
-require 'application'
+require 'application_controller'
 
 # Re-raise errors caught by the controller.
 class ApplicationController; def rescue_action(e) raise e end; end
 
-class ApplicationControllerTest < Test::Unit::TestCase
+class ApplicationControllerTest < ActionController::TestCase
   include Redmine::I18n
   
   def setup
index 3a4b8978536d5703179446d737b7d70b38128acf..bf57349fe2426d72dee2c48b52fa845968e116cf 100644 (file)
@@ -22,7 +22,7 @@ require 'attachments_controller'
 class AttachmentsController; def rescue_action(e) raise e end; end
 
 
-class AttachmentsControllerTest < Test::Unit::TestCase
+class AttachmentsControllerTest < ActionController::TestCase
   fixtures :users, :projects, :roles, :members, :member_roles, :enabled_modules, :issues, :trackers, :attachments,
            :versions, :wiki_pages, :wikis, :documents
   
index eb9a50ea509a53a9b5c93e903cc8d4dd72659613..254ee93856d8fb5b30502eea202b84f13b600253 100644 (file)
@@ -21,7 +21,7 @@ require 'boards_controller'
 # Re-raise errors caught by the controller.
 class BoardsController; def rescue_action(e) raise e end; end
 
-class BoardsControllerTest < Test::Unit::TestCase
+class BoardsControllerTest < ActionController::TestCase
   fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
   
   def setup
index 10af23563a5a6f8dd0918e9cd5762d0b563bbb66..5b27446bd1d875cbb1cbb0d7f5494593bf8f796e 100644 (file)
@@ -21,7 +21,7 @@ require 'custom_fields_controller'
 # Re-raise errors caught by the controller.\r
 class CustomFieldsController; def rescue_action(e) raise e end; end\r
 \r
-class CustomFieldsControllerTest < Test::Unit::TestCase\r
+class CustomFieldsControllerTest < ActionController::TestCase\r
   fixtures :custom_fields, :trackers, :users\r
   \r
   def setup\r
index c0fe0957e65f50525336c4021a00fca99f8988f5..11c706596839383df200e413578c034654815f45 100644 (file)
@@ -21,7 +21,7 @@ require 'documents_controller'
 # Re-raise errors caught by the controller.
 class DocumentsController; def rescue_action(e) raise e end; end
 
-class DocumentsControllerTest < Test::Unit::TestCase
+class DocumentsControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations
   
   def setup
index afbe23aaa85d09aabeb7faadf3dce9d6ceea3fef..8c66186f14e4c15b4ae45b84a95f12953022a849 100644 (file)
@@ -21,7 +21,7 @@ require 'enumerations_controller'
 # Re-raise errors caught by the controller.
 class EnumerationsController; def rescue_action(e) raise e end; end
 
-class EnumerationsControllerTest < Test::Unit::TestCase
+class EnumerationsControllerTest < ActionController::TestCase
   fixtures :enumerations, :issues, :users
   
   def setup
index ac61db425de21bc3c6ce89ace6f6d667897178d5..91fc42c3492ed5612f81ad63402398403558b6eb 100644 (file)
@@ -21,7 +21,7 @@ require 'groups_controller'
 # Re-raise errors caught by the controller.
 class GroupsController; def rescue_action(e) raise e end; end
 
-class GroupsControllerTest < Test::Unit::TestCase
+class GroupsControllerTest < ActionController::TestCase
   fixtures :projects, :users, :members, :member_roles
   
   def setup
index ffb87339d418f0a22a0692cb35c3d0168f80e3bd..3d1dd069a44907711229e6afa14db9538236e95b 100644 (file)
@@ -21,7 +21,7 @@ require 'issue_categories_controller'
 # Re-raise errors caught by the controller.
 class IssueCategoriesController; def rescue_action(e) raise e end; end
 
-class IssueCategoriesControllerTest < Test::Unit::TestCase
+class IssueCategoriesControllerTest < ActionController::TestCase
   fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules, :issue_categories
   
   def setup
index a23f64a96e1c1735f628449771ed2bc352746255..85661749f432bb71dba04ba46d3715d55ce12100 100644 (file)
@@ -5,7 +5,7 @@ require 'issue_relations_controller'
 class IssueRelationsController; def rescue_action(e) raise e end; end
 
 
-class IssueRelationsControllerTest < Test::Unit::TestCase
+class IssueRelationsControllerTest < ActionController::TestCase
   fixtures :projects,
            :users,
            :roles,
index 95e75b43b43d3b314868e7f6141b5a2912223994..0d282c127e41e511dd54b72f717d74fc71cab590 100644 (file)
@@ -21,7 +21,7 @@ require 'issues_controller'
 # Re-raise errors caught by the controller.
 class IssuesController; def rescue_action(e) raise e end; end
 
-class IssuesControllerTest < Test::Unit::TestCase
+class IssuesControllerTest < ActionController::TestCase
   fixtures :projects,
            :users,
            :roles,
@@ -42,7 +42,8 @@ class IssuesControllerTest < Test::Unit::TestCase
            :custom_fields_trackers,
            :time_entries,
            :journals,
-           :journal_details
+           :journal_details,
+           :queries
   
   def setup
     @controller = IssuesController.new
@@ -452,14 +453,16 @@ class IssuesControllerTest < Test::Unit::TestCase
   
   def test_post_new
     @request.session[:user_id] = 2
-    post :new, :project_id => 1, 
-               :issue => {:tracker_id => 3,
-                          :subject => 'This is the test_new issue',
-                          :description => 'This is the description',
-                          :priority_id => 5,
-                          :estimated_hours => '',
-                          :custom_field_values => {'2' => 'Value for field 2'}}
-    assert_redirected_to :action => 'show'
+    assert_difference 'Issue.count' do
+      post :new, :project_id => 1, 
+                 :issue => {:tracker_id => 3,
+                            :subject => 'This is the test_new issue',
+                            :description => 'This is the description',
+                            :priority_id => 5,
+                            :estimated_hours => '',
+                            :custom_field_values => {'2' => 'Value for field 2'}}
+    end
+    assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
     
     issue = Issue.find_by_subject('This is the test_new issue')
     assert_not_nil issue
@@ -483,12 +486,14 @@ class IssuesControllerTest < Test::Unit::TestCase
   
   def test_post_new_without_custom_fields_param
     @request.session[:user_id] = 2
-    post :new, :project_id => 1, 
-               :issue => {:tracker_id => 1,
-                          :subject => 'This is the test_new issue',
-                          :description => 'This is the description',
-                          :priority_id => 5}
-    assert_redirected_to :action => 'show'
+    assert_difference 'Issue.count' do
+      post :new, :project_id => 1, 
+                 :issue => {:tracker_id => 1,
+                            :subject => 'This is the test_new issue',
+                            :description => 'This is the description',
+                            :priority_id => 5}
+    end
+    assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
   end
 
   def test_post_new_with_required_custom_field_and_without_custom_fields_param
@@ -536,14 +541,16 @@ class IssuesControllerTest < Test::Unit::TestCase
   def test_post_new_should_send_a_notification
     ActionMailer::Base.deliveries.clear
     @request.session[:user_id] = 2
-    post :new, :project_id => 1, 
-               :issue => {:tracker_id => 3,
-                          :subject => 'This is the test_new issue',
-                          :description => 'This is the description',
-                          :priority_id => 5,
-                          :estimated_hours => '',
-                          :custom_field_values => {'2' => 'Value for field 2'}}
-    assert_redirected_to :action => 'show'
+    assert_difference 'Issue.count' do
+      post :new, :project_id => 1, 
+                 :issue => {:tracker_id => 3,
+                            :subject => 'This is the test_new issue',
+                            :description => 'This is the description',
+                            :priority_id => 5,
+                            :estimated_hours => '',
+                            :custom_field_values => {'2' => 'Value for field 2'}}
+    end
+    assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
     
     assert_equal 1, ActionMailer::Base.deliveries.size
   end
index ae112ab6fb0c590ae806ba3a803a9522ef6d6c35..0a11bab3e4946a2fbd55e1d3afb7b3349ee35994 100644 (file)
@@ -21,7 +21,7 @@ require 'journals_controller'
 # Re-raise errors caught by the controller.
 class JournalsController; def rescue_action(e) raise e end; end
 
-class JournalsControllerTest < Test::Unit::TestCase
+class JournalsControllerTest < ActionController::TestCase
   fixtures :projects, :users, :members, :member_roles, :roles, :issues, :journals, :journal_details, :enabled_modules
   
   def setup
index e99f99a2c090befb6b546149d11a75fc95291e02..8365f3170e7c519b13f5eadaced8b331443f110e 100644 (file)
@@ -21,7 +21,7 @@ require 'mail_handler_controller'
 # Re-raise errors caught by the controller.
 class MailHandlerController; def rescue_action(e) raise e end; end
 
-class MailHandlerControllerTest < Test::Unit::TestCase
+class MailHandlerControllerTest < ActionController::TestCase
   fixtures :users, :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :issue_statuses, :trackers, :enumerations
   
   FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler'
index 91f36abecc013b48f8d11012750bd848d54b8e93..bc5f92e88e541e59f56c811867ec1e6c7917269d 100644 (file)
@@ -22,7 +22,7 @@ require 'members_controller'
 class MembersController; def rescue_action(e) raise e end; end
 
 
-class MembersControllerTest < Test::Unit::TestCase
+class MembersControllerTest < ActionController::TestCase
   fixtures :projects, :members, :member_roles, :roles, :users
   
   def setup
index 70061aca3564ad6dfa307317ee6fe27fb754cbaa..2522f0a87d741431eb1d969f63dff74157faada2 100644 (file)
@@ -21,7 +21,7 @@ require 'messages_controller'
 # Re-raise errors caught by the controller.
 class MessagesController; def rescue_action(e) raise e end; end
 
-class MessagesControllerTest < Test::Unit::TestCase
+class MessagesControllerTest < ActionController::TestCase
   fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
   
   def setup
index 99734009683b8e92795d44f892af44e800eba532..8862466e7952a9b4e393e6387b3593bddfed5df0 100644 (file)
@@ -21,7 +21,7 @@ require 'my_controller'
 # Re-raise errors caught by the controller.
 class MyController; def rescue_action(e) raise e end; end
 
-class MyControllerTest < Test::Unit::TestCase
+class MyControllerTest < ActionController::TestCase
   fixtures :users, :issues, :issue_statuses, :trackers, :enumerations, :custom_fields
   
   def setup
index cea35ca4a62cfb5bab360df53ab8426ce099059c..427d75b75b61e68b2a8189f1fb08a6d1ed387835 100644 (file)
@@ -21,7 +21,7 @@ require 'news_controller'
 # Re-raise errors caught by the controller.
 class NewsController; def rescue_action(e) raise e end; end
 
-class NewsControllerTest < Test::Unit::TestCase
+class NewsControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments
   
   def setup
index 0560a54b653a61174bf4fc61a16a54f45aec9a2e..81b501ea50c57b0b15bf698e922427db5349c29a 100644 (file)
@@ -21,7 +21,7 @@ require 'projects_controller'
 # Re-raise errors caught by the controller.
 class ProjectsController; def rescue_action(e) raise e end; end
 
-class ProjectsControllerTest < Test::Unit::TestCase
+class ProjectsControllerTest < ActionController::TestCase
   fixtures :projects, :versions, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details,
            :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages,
            :attachments
index 8edde44aaed069f30135f4703d378079fb366717..af2a86e11041ed54f30c8c49cab9a8534622eee7 100644 (file)
@@ -21,7 +21,7 @@ require 'queries_controller'
 # Re-raise errors caught by the controller.
 class QueriesController; def rescue_action(e) raise e end; end
 
-class QueriesControllerTest < Test::Unit::TestCase
+class QueriesControllerTest < ActionController::TestCase
   fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
   
   def setup
@@ -70,7 +70,7 @@ class QueriesControllerTest < Test::Unit::TestCase
          :query => {"name" => "test_new_project_public_query", "is_public" => "1"}
          
     q = Query.find_by_name('test_new_project_public_query')
-    assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q
+    assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
     assert q.is_public?
     assert q.has_default_columns?
     assert q.valid?
@@ -88,7 +88,7 @@ class QueriesControllerTest < Test::Unit::TestCase
          :query => {"name" => "test_new_project_private_query", "is_public" => "1"}
          
     q = Query.find_by_name('test_new_project_private_query')
-    assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q
+    assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
     assert !q.is_public?
     assert q.has_default_columns?
     assert q.valid?
@@ -104,7 +104,7 @@ class QueriesControllerTest < Test::Unit::TestCase
          :query => {"name" => "test_new_global_private_query", "is_public" => "1", "column_names" => ["", "tracker", "subject", "priority", "category"]}
          
     q = Query.find_by_name('test_new_global_private_query')
-    assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q
+    assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
     assert !q.is_public?
     assert !q.has_default_columns?
     assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name}
index 125b175c6b960a503d306c2b41e767bfe1ccbc9f..ab33b3035bb2e1462a2935a9e165c846d4467299 100644 (file)
@@ -22,7 +22,7 @@ require 'reports_controller'
 class ReportsController; def rescue_action(e) raise e end; end
 
 
-class ReportsControllerTest < Test::Unit::TestCase
+class ReportsControllerTest < ActionController::TestCase
   fixtures :all
   
   def setup
index 98aa2369ff6bf7ea4bbd3e8ba4c0c3b9ff80238e..18841d54e4774f111fd1581dcb9397a11749b9bc 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesBazaarControllerTest < Test::Unit::TestCase
+class RepositoriesBazaarControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
 
   # No '..' in the repository path
index d51a42976100b3230d9efa64ad8c192ca74747b5..d786c2e2106e8187e7a4ca62683ba5edb5b5c53c 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesControllerTest < Test::Unit::TestCase
+class RepositoriesControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
   
   def setup
index c728bf362e8ede24ac07f39e8642c7212f5ea500..f3d4ecfe1c26188cf562611aa14671aa74d8ef73 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesCvsControllerTest < Test::Unit::TestCase
+class RepositoriesCvsControllerTest < ActionController::TestCase
 
   # No '..' in the repository path
   REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
index 3f841e9a1f46d4caf3ba8789a2e6f6dca1a07235..b605ff82b2f4641cc1dc5e2e85fa843b62f1a967 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesDarcsControllerTest < Test::Unit::TestCase
+class RepositoriesDarcsControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
 
   # No '..' in the repository path
index 6c2502f5165a334fd8f587efd19dcb86ca884600..37c6fb848297a4a5c74b1c405e8127911a294d4f 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesGitControllerTest < Test::Unit::TestCase
+class RepositoriesGitControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
 
   # No '..' in the repository path
index ec2526550a13dec83758e08195baa564fb881a10..f2639ee9271ad21c38d7ddc64c0e366dc104cb42 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesMercurialControllerTest < Test::Unit::TestCase
+class RepositoriesMercurialControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
 
   # No '..' in the repository path
index fe1b3dbe50c5a210a651d051f72a75ddae108720..865bae35c2d44f8c9da66bb891fe9307eb6f2e7c 100644 (file)
@@ -21,7 +21,7 @@ require 'repositories_controller'
 # Re-raise errors caught by the controller.
 class RepositoriesController; def rescue_action(e) raise e end; end
 
-class RepositoriesSubversionControllerTest < Test::Unit::TestCase
+class RepositoriesSubversionControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
            :repositories, :issues, :issue_statuses, :changesets, :changes,
            :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
index 61e9bd6df7991247c5b0cf48c4910576b6c1c666..20040883781ff486dc03a14c6005e5e35f8129bb 100644 (file)
@@ -21,7 +21,7 @@ require 'roles_controller'
 # Re-raise errors caught by the controller.
 class RolesController; def rescue_action(e) raise e end; end
 
-class RolesControllerTest < Test::Unit::TestCase
+class RolesControllerTest < ActionController::TestCase
   fixtures :roles, :users, :members, :member_roles, :workflows
   
   def setup
index 4f79081ae82c8d814d2da442f60afaa9a8c9fa5a..b062468a60e64b98b41afdd9615f72bd6e9ca593 100644 (file)
@@ -4,7 +4,7 @@ require 'search_controller'
 # Re-raise errors caught by the controller.
 class SearchController; def rescue_action(e) raise e end; end
 
-class SearchControllerTest < Test::Unit::TestCase
+class SearchControllerTest < ActionController::TestCase
   fixtures :projects, :enabled_modules, :roles, :users, :members, :member_roles,
            :issues, :trackers, :issue_statuses,
            :custom_fields, :custom_values,
index 0e919a7413b61f5326fb7677762927430e21ec78..1e0c48f0eea2edc828c251c723907eca7012f52d 100644 (file)
@@ -21,7 +21,7 @@ require 'settings_controller'
 # Re-raise errors caught by the controller.
 class SettingsController; def rescue_action(e) raise e end; end
 
-class SettingsControllerTest < Test::Unit::TestCase
+class SettingsControllerTest < ActionController::TestCase
   fixtures :users
   
   def setup
index db9dd2aa3f5816dd0df090bb48b396ce7cc22e2b..59b1d2af6ef62c7edf666154129d05d8bc3f832b 100644 (file)
@@ -21,7 +21,7 @@ require 'sys_controller'
 # Re-raise errors caught by the controller.
 class SysController; def rescue_action(e) raise e end; end
 
-class SysControllerTest < Test::Unit::TestCase
+class SysControllerTest < ActionController::TestCase
   fixtures :projects, :repositories
   
   def setup
index df80f5d5a744742c7a92e14423a5be49a65234f9..371fded187e7e605026a847b59a2aeea96ade954 100644 (file)
@@ -21,7 +21,7 @@ require 'timelog_controller'
 # Re-raise errors caught by the controller.
 class TimelogController; def rescue_action(e) raise e end; end
 
-class TimelogControllerTest < Test::Unit::TestCase
+class TimelogControllerTest < ActionController::TestCase
   fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values
 
   def setup
index e2109ba6f9b2a7430399bdf0d0dd0a77a8625ada..ec412245abf6c8da8f7310534ddd0da4b47692fd 100644 (file)
@@ -21,7 +21,7 @@ require 'trackers_controller'
 # Re-raise errors caught by the controller.
 class TrackersController; def rescue_action(e) raise e end; end
 
-class TrackersControllerTest < Test::Unit::TestCase
+class TrackersControllerTest < ActionController::TestCase
   fixtures :trackers, :projects, :projects_trackers, :users, :issues
   
   def setup
index 5f62b1549bcb6308f9e70be7d9ec46047574d81c..df87462a88f1d1de2a7fe7b9ea8ba6803153da7d 100644 (file)
@@ -21,7 +21,7 @@ require 'users_controller'
 # Re-raise errors caught by the controller.
 class UsersController; def rescue_action(e) raise e end; end
 
-class UsersControllerTest < Test::Unit::TestCase
+class UsersControllerTest < ActionController::TestCase
   include Redmine::I18n
   
   fixtures :users, :projects, :members, :member_roles, :roles
index 3d212def3e9f51db0bbdee956e88c1734ed268ac..4343b887ad61bdae58b9211eb8fd6daf87c20191 100644 (file)
@@ -21,7 +21,7 @@ require 'versions_controller'
 # Re-raise errors caught by the controller.
 class VersionsController; def rescue_action(e) raise e end; end
 
-class VersionsControllerTest < Test::Unit::TestCase
+class VersionsControllerTest < ActionController::TestCase
   fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules
   
   def setup
index 275599f9bfba9884815b1419cefa8eb928e0fcbf..3b48767b96af90c9e66aa9bd91cb760c4b327a83 100644 (file)
@@ -21,7 +21,7 @@ require 'watchers_controller'
 # Re-raise errors caught by the controller.
 class WatchersController; def rescue_action(e) raise e end; end
 
-class WatchersControllerTest < Test::Unit::TestCase
+class WatchersControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
            :issues, :trackers, :projects_trackers, :issue_statuses, :enumerations, :watchers
   
index 0376fd857548ef0d4e30fe1f056a2ecb795e9624..5fef176abf5d777e7eb1679ef5fd634f56e5e219 100644 (file)
@@ -21,7 +21,7 @@ require 'welcome_controller'
 # Re-raise errors caught by the controller.
 class WelcomeController; def rescue_action(e) raise e end; end
 
-class WelcomeControllerTest < Test::Unit::TestCase
+class WelcomeControllerTest < ActionController::TestCase
   fixtures :projects, :news
   
   def setup
index 9d104c527a0c9286cc6a3463dc861ef39956f21f..cf247db809f564e21be5f1561815398954c7ac1e 100644 (file)
@@ -21,7 +21,7 @@ require 'wiki_controller'
 # Re-raise errors caught by the controller.
 class WikiController; def rescue_action(e) raise e end; end
 
-class WikiControllerTest < Test::Unit::TestCase
+class WikiControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments
   
   def setup
index 7a5634f1d0088fdf92a7af1dd627fb338e160f53..dc7df4d952b61869596c975159dcc1c004c07cba 100644 (file)
@@ -21,7 +21,7 @@ require 'wikis_controller'
 # Re-raise errors caught by the controller.
 class WikisController; def rescue_action(e) raise e end; end
 
-class WikisControllerTest < Test::Unit::TestCase
+class WikisControllerTest < ActionController::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis
   
   def setup
index d6078bbb90a832d0ba61a61e02236a6ae026ffb2..19187b7fed5ece45fb1949b08cc041bb0cdf6ae1 100644 (file)
@@ -21,7 +21,7 @@ require 'workflows_controller'
 # Re-raise errors caught by the controller.
 class WorkflowsController; def rescue_action(e) raise e end; end
 
-class WorkflowsControllerTest < Test::Unit::TestCase
+class WorkflowsControllerTest < ActionController::TestCase
   fixtures :roles, :trackers, :workflows
   
   def setup
index aba6784a02382d262a54a5806d07d036a246be6f..1ce9d8661b66c6a16550ebfc0e608ce22e17a7a0 100644 (file)
@@ -4,7 +4,7 @@ class StubController < ApplicationController
   attr_accessor :request, :url
 end
 
-class HelperTestCase < Test::Unit::TestCase
+class HelperTestCase < ActiveSupport::TestCase
 
   # Add other helpers here if you need them
   include ActionView::Helpers::ActiveRecordHelper
index 88117e540a0de8b4be234fffe23896d406bd249a..fba2987d3ff3977d66a69cadadf7ab2958321d90 100644 (file)
@@ -21,7 +21,7 @@ require 'test_help'
 require File.expand_path(File.dirname(__FILE__) + '/helper_testcase')
 require File.join(RAILS_ROOT,'test', 'mocks', 'open_id_authentication_mock.rb')
 
-class Test::Unit::TestCase
+class ActiveSupport::TestCase
   # Transactional fixtures accelerate your tests by wrapping each test method
   # in a transaction that's rolled back on completion.  This ensures that the
   # test database remains unchanged so your fixtures don't have to be reloaded
@@ -55,7 +55,7 @@ class Test::Unit::TestCase
   end
   
   def test_uploaded_file(name, mime)
-    ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + "/files/#{name}", mime)
+    ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime)
   end
   
   # Use a temporary directory for attachment related tests
index 0b1773dd24b2b2d35a69927a264e3889bc9c6838..86a07e6a50d2f911bd3cf91d95a30cfc4f4c005b 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class ActivityTest < Test::Unit::TestCase
+class ActivityTest < ActiveSupport::TestCase
   fixtures :projects, :versions, :attachments, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details,
            :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages
 
index ae92991f85c24b8d109b73312c99977ffb1daf8a..75a7a3c90f69d54f61bb6ff5a7bb933830b119a1 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class AttachmentTest < Test::Unit::TestCase
+class AttachmentTest < ActiveSupport::TestCase
   fixtures :issues, :users
   
   def setup
index 30abd5dd8d48ef4b21e47359728c3f8f85c2ef78..d0f7a6edf1b8e65e7e6ea4a7136f44c7e4c902bc 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class AuthSourceLdapTest < Test::Unit::TestCase
+class AuthSourceLdapTest < ActiveSupport::TestCase
 
   def setup
   end
index 3ba4b2d97bc52fe1bb7783a8d88a94a396f7954c..569c4620a055dcd1b82d6871e3501f64ce802398 100644 (file)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
-class BoardTest < Test::Unit::TestCase
+class BoardTest < ActiveSupport::TestCase
   fixtures :projects, :boards, :messages
 
   def setup
index 98d8569215bf3932101a61a2b208b2543d890a2d..05e1d0badf4a77fe9ce2781543f4be11f453fe8b 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class CalendarTest < Test::Unit::TestCase
+class CalendarTest < ActiveSupport::TestCase
   
   def test_monthly
     c = Redmine::Helpers::Calendar.new(Date.today, :fr, :month)
index 51d8b7452cbaf0405ce99cac29fcc94ca3ddd5a0..9af53a3ca766aef609814ed6ad87529bdebac526 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class ChangesetTest < Test::Unit::TestCase
+class ChangesetTest < ActiveSupport::TestCase
   fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :member_roles, :trackers
 
   def setup
index c07ee82737ba3f1304e5fc04780aea712a28c23b..0a62148c309eb157008a6f4e0ef6f6802070a6c8 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class CommentTest < Test::Unit::TestCase
+class CommentTest < ActiveSupport::TestCase
   fixtures :users, :news, :comments
 
   def setup
index 2f17d99cfb57fe8f022afa2146ad6d92cb73aec6..513c6fb2eef260494a8ed5d9b14a8c1088dba3b4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class CustomFieldTest < Test::Unit::TestCase
+class CustomFieldTest < ActiveSupport::TestCase
   fixtures :custom_fields
   
   def test_create
index 11578ae6b95978253bc2251404868cfe165ee39f..08492ef581bc4df9eca3c731eda31bbde00d66e9 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class CustomValueTest < Test::Unit::TestCase
+class CustomValueTest < ActiveSupport::TestCase
   fixtures :custom_fields
 
   def test_string_field_validation_with_blank_value
index 457f885eed384cec206f7d54ab217bdcc7c06704..a63d205c1f414cf187d6d2cfa379bdd2968fb71f 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class DefaultDataTest < Test::Unit::TestCase
+class DefaultDataTest < ActiveSupport::TestCase
   include Redmine::I18n
   fixtures :roles
   
index 6fa93a371d02ef6a5ab356ec46bb9ffb70390c40..8b814432c7d104f68bb8f0f16e799ab5bcb03a17 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class DocumentCategoryTest < Test::Unit::TestCase
+class DocumentCategoryTest < ActiveSupport::TestCase
   fixtures :enumerations, :documents
 
   def test_should_be_an_enumeration
index 1950f8558c214e1bad32443c2d8b1d6816a05023..02ae94dd0b9cd737cf450f22817edefba2fddeec 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class DocumentTest < Test::Unit::TestCase
+class DocumentTest < ActiveSupport::TestCase
   fixtures :projects, :enumerations, :documents
 
   def test_create
index 3daec434f0c0e870bc1ac5d629bd9a88316f7849..5e662ebc744f689caa60d2c716ddf90210e90119 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class EnabledModuleTest < Test::Unit::TestCase
+class EnabledModuleTest < ActiveSupport::TestCase
   fixtures :projects, :wikis
   
   def test_enabling_wiki_should_create_a_wiki
index 14ea5e25c832e467fd40e58c2d40730a71e0df33..4dc6e15c345be7343b5b4638e0cf58b4b4eef50d 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class EnumerationTest < Test::Unit::TestCase
+class EnumerationTest < ActiveSupport::TestCase
   fixtures :enumerations, :issues
 
   def setup
index 720d1e92cf096f9eac185c3f926ff6fbfbd2912b..26e97bda6d44699be0c3cc581225aab23aac7ae3 100644 (file)
@@ -2,7 +2,7 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 
-class FilesystemAdapterTest < Test::Unit::TestCase
+class FilesystemAdapterTest < ActiveSupport::TestCase
   
   REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'  
   
index 50bded06240efd24a63ef3e47bac21a84774d2e5..9ab25c1542efab437fc66409a8a69ff9107a22ab 100644 (file)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
-class GitAdapterTest < Test::Unit::TestCase
+class GitAdapterTest < ActiveSupport::TestCase
   REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
 
   if File.directory?(REPOSITORY_PATH)  
index 79b9d41802e8b1ffdd139e1be67ee5f23a8aca4d..4b26f8f2cd5bcdb44bfc4c7d0d749201da6a1b5a 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class GroupTest < Test::Unit::TestCase
+class GroupTest < ActiveSupport::TestCase
   fixtures :all
 
   def test_create
index a6edb3c7bfe47fc906218cc169e8cb6e01ba1f7f..ebb9f0f13f6c2682f85accaca3aea73dd57de162 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class IssueCategoryTest < Test::Unit::TestCase
+class IssueCategoryTest < ActiveSupport::TestCase
   fixtures :issue_categories, :issues
 
   def setup
index e2da1e82d331ce80498f90d6a6d6c071cd1100b5..6574bf38cc060915bdd3e89017502afa708c09d4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class IssuePriorityTest < Test::Unit::TestCase
+class IssuePriorityTest < ActiveSupport::TestCase
   fixtures :enumerations, :issues
 
   def test_should_be_an_enumeration
index aebe74cb678b4cd0f406c448501a8038f8f10534..042f30e32085f9c09e638bed9102744217f4fc89 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class IssueStatusTest < Test::Unit::TestCase
+class IssueStatusTest < ActiveSupport::TestCase
   fixtures :issue_statuses, :issues
 
   def test_create
index a6710edc0ceb566ca502f85e0a8c21def4d8eb4e..147d31f8c3bec95d223041cf5fd856cfcc2f3d0f 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class IssueTest < Test::Unit::TestCase
+class IssueTest < ActiveSupport::TestCase
   fixtures :projects, :users, :members, :member_roles,
            :trackers, :projects_trackers,
            :issue_statuses, :issue_categories, :issue_relations, :workflows, 
index 147af4aaefc447fd50b0961caab3df7dc880a9b9..87273ad4642749f67043cbc5dff3e518a0a66c6e 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class JournalTest < Test::Unit::TestCase
+class JournalTest < ActiveSupport::TestCase
   fixtures :issues, :issue_statuses, :journals, :journal_details
 
   def setup
index 5dd87d28c4edf84510634c436e013c552064fccd..dcc84c19fa7b64dd07e95991f4ba7075108a5bb8 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../../../test_helper'
 
-class Redmine::AccessControlTest < Test::Unit::TestCase
+class Redmine::AccessControlTest < ActiveSupport::TestCase
   
   def setup
     @access_module = Redmine::AccessControl
index 9313a36c7abd01eff5c7c2b1e94db67891709093..de74f1e57bbe6c1f705c15a60ecbe9385d31e2fb 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../../../test_helper'
 
-class Redmine::Hook::ManagerTest < Test::Unit::TestCase
+class Redmine::Hook::ManagerTest < ActiveSupport::TestCase
 
   fixtures :issues
   
index 8b91359a9e659f539242260f57afc63cdcf89b7d..35401f1c28436eb453d8fbf79503fa61dd2801f0 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../../../test_helper'
 
-class Redmine::I18nTest < Test::Unit::TestCase
+class Redmine::I18nTest < ActiveSupport::TestCase
   include Redmine::I18n
   
   def setup
index 79d086944b205a2e0846082b18a6b8e17f6d636f..2cf1518411b2508407d570308559258acf6ab617 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../../../test_helper'
 
-class Redmine::MimeTypeTest < Test::Unit::TestCase
+class Redmine::MimeTypeTest < ActiveSupport::TestCase
   
   def test_of
     to_test = {'test.unk' => nil,
index e6237c216735a7449b90cd21a88768d8c3dec91e..234da14ea6d0e0fa2dddae8f7b43a126390720b4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../../../test_helper'
 
-class Redmine::PluginTest < Test::Unit::TestCase
+class Redmine::PluginTest < ActiveSupport::TestCase
 
   def setup
     @klass = Redmine::Plugin
index 5e6ba1aef76b736e37094f1ed53a0f0397acb747..5b26cde25d8d386945ed16e43e4d9f906dd07d35 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../../../test_helper'
 
-class Redmine::UnifiedDiffTest < Test::Unit::TestCase
+class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
   
   def setup
   end
index 9a9d7d805b4a7693399c801c66e27af78e889b32..9b6c28ba3d4dc1c83b08bcb5e3747c7ba2b05551 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class MailHandlerTest < Test::Unit::TestCase
+class MailHandlerTest < ActiveSupport::TestCase
   fixtures :users, :projects, 
                    :enabled_modules,
                    :roles,
index b1c39bb5ef6a8d9284efad94b7c654847b755048..5024a845bc250909fc84e6b08f0c016db162202d 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class MailerTest < Test::Unit::TestCase
+class MailerTest < ActiveSupport::TestCase
   include Redmine::I18n
   fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories
   
@@ -103,9 +103,19 @@ class MailerTest < Test::Unit::TestCase
     journal = Journal.find(2)
     Mailer.deliver_issue_edit(journal)
     mail = ActionMailer::Base.deliveries.last
-    assert !mail.body.include?('<a href="https://mydomain.foo/issues/1">Bug #1: Can\'t print recipes</a>')
+    assert_equal 1, mail.parts.size
+    assert !mail.encoded.include?('href')
   end
-  
+
+  def test_html_mail
+    Setting.plain_text_mail = 0
+    journal = Journal.find(2)
+    Mailer.deliver_issue_edit(journal)
+    mail = ActionMailer::Base.deliveries.last
+    assert_equal 2, mail.parts.size
+    assert mail.encoded.include?('href')
+  end
+
   def test_issue_add_message_id
     ActionMailer::Base.deliveries.clear
     issue = Issue.find(1)
index 66f1283ca2cc4667c0730013edd5bf06d4077af5..87e0086d20ee01b6e5a4611ac7536b1cee20b4d5 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class MemberTest < Test::Unit::TestCase
+class MemberTest < ActiveSupport::TestCase
   fixtures :users, :projects, :roles, :members, :member_roles
 
   def setup
index a2673ad42b9f6a8f0d43d258c3a7d7c80c4774b8..f7b0d3c5b322befcd6fdaa2da2867e1b31cbd7fc 100644 (file)
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../test_helper'
 begin
   require 'mocha'
   
-  class MercurialAdapterTest < Test::Unit::TestCase
+  class MercurialAdapterTest < ActiveSupport::TestCase
     
     TEMPLATES_DIR = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATES_DIR
     TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME
index 09857fbc9594075b14cc72976521dc22125bbef8..5bce8a899471de15bc860d4cb0f8df3a0e5b7c5a 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class MessageTest < Test::Unit::TestCase
+class MessageTest < ActiveSupport::TestCase
   fixtures :projects, :roles, :members, :member_roles, :boards, :messages, :users, :watchers
 
   def setup
index a4fc89e90f2895ad5baba0134bbf9023ddeabc97..e9d3880e5b1ac4a1feda615f3a80879b6db101de 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class NewsTest < Test::Unit::TestCase
+class NewsTest < ActiveSupport::TestCase
   fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news
 
   def valid_news
index 13c63a054e7b367a013d6213aab5ce5c78dc7b47..c40475e4ca0527ffeaf7e2f72d235d221d14f940 100644 (file)
@@ -17,7 +17,7 @@
 \r
 require File.dirname(__FILE__) + '/../test_helper'\r
 \r
-class ProjectTest < Test::Unit::TestCase\r
+class ProjectTest < ActiveSupport::TestCase\r
   fixtures :projects, :enabled_modules, \r
            :issues, :issue_statuses, :journals, :journal_details,\r
            :users, :members, :member_roles, :roles, :projects_trackers, :trackers, :boards,\r
index 73efa426f9b5a7714fd175603e9821d627cc0cd1..f1f9397c6fb7feca1b53f64e1657569361b1e1a2 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class QueryTest < Test::Unit::TestCase
+class QueryTest < ActiveSupport::TestCase
   fixtures :projects, :enabled_modules, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries
 
   def test_custom_fields_for_all_projects_should_be_available_in_global_queries
index b7a3cf98e06de45d609b5a1a1764fcfcfd58fc86..c29e04edeb90a92c10d8158cdddba2524eb31dd8 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositoryBazaarTest < Test::Unit::TestCase
+class RepositoryBazaarTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path
index 47c4070374680b18c50bd793937d685adf1ddc4f..d240a6efde853d177079442be4a73816ef73ef3c 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 require 'pp'
-class RepositoryCvsTest < Test::Unit::TestCase
+class RepositoryCvsTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path
index 0c8c9a1439d4d069dd73103ec41b542f620e46ce..b9ad95db62f827fe347e9012fecedcd74bcbee6f 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositoryDarcsTest < Test::Unit::TestCase
+class RepositoryDarcsTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path
index 6b643f96faaac2982fb05365d2f36dadfccccb5f..7688dd4ee31bb27bcbff0943605708bdfba9d807 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositoryFilesystemTest < Test::Unit::TestCase
+class RepositoryFilesystemTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path
index 382774305d08d414add416b5d33d16d4252547a4..5ebbb00c15782e6b6c3111180d1b7dd75af437c4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositoryGitTest < Test::Unit::TestCase
+class RepositoryGitTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path
index 0f993ac163aa99d2042775af6eefebb8aba720f3..6ce3d5fa023375156e1d0f99c4e5ac4775b7127c 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositoryMercurialTest < Test::Unit::TestCase
+class RepositoryMercurialTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path
index b0eb88c01566cda06042b6ba5cb500d921d7fed4..17a0a42b0451b11509ac37090273b99a979ac521 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositorySubversionTest < Test::Unit::TestCase
+class RepositorySubversionTest < ActiveSupport::TestCase
   fixtures :projects
   
   # No '..' in the repository path for svn
index 497eeabfdf9c0f0e150ec23d2de9fb193aec7538..cc356ec1d3cd95ebc69f059ded7f304ebb42a5c1 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RepositoryTest < Test::Unit::TestCase
+class RepositoryTest < ActiveSupport::TestCase
   fixtures :projects,
            :trackers,
            :projects_trackers,
index cab668c504f6d71d1f57a2068721e6f78e3887b0..1e76dd887fa8e8440fce4990d6fe55a1757ce67c 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class RoleTest < Test::Unit::TestCase
+class RoleTest < ActiveSupport::TestCase
   fixtures :roles, :workflows
 
   def test_copy_workflows
index 46d769451cf768efba5d0c2b9376b98b6fd62b15..71ed7ad089c4dd753ddaf08428cd63139b11461a 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class SearchTest < Test::Unit::TestCase
+class SearchTest < ActiveSupport::TestCase
   fixtures :users,
            :members, 
            :member_roles,
index 34d07c1933a0adba00a9dc1a5dee44964d966c28..25ec41701042b891ecf8ec88c3c0740f85753abb 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class SettingTest < Test::Unit::TestCase
+class SettingTest < ActiveSupport::TestCase
   
   def test_read_default
     assert_equal "Redmine", Setting.app_title
index 9f208839a719daa19c0a1ca859ac059eae15fbef..ddef52df252f0424bf30144710506176c8828bd5 100644 (file)
@@ -19,7 +19,7 @@ require 'mkmf'
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class SubversionAdapterTest < Test::Unit::TestCase
+class SubversionAdapterTest < ActiveSupport::TestCase
   
   if find_executable0('svn')
     def test_client_version
index f99c8ab4ef565daaad62b416ad80c065ed946d0c..9422a91ab776c5589284444dbb3be8399de51e79 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class TimeEntryActivityTest < Test::Unit::TestCase
+class TimeEntryActivityTest < ActiveSupport::TestCase
   fixtures :enumerations, :time_entries
 
   def test_should_be_an_enumeration
index dd54fd1b2dae2f3d24326931181d222f6beec9d9..7ac1c02a365eb8eeb41fe79ea8b934316df5edf4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class TimeEntryTest < Test::Unit::TestCase
+class TimeEntryTest < ActiveSupport::TestCase
   fixtures :issues, :projects, :users, :time_entries
 
   def test_hours_format
index 64ac85a39d8f92ad812fcaa6fbf1bd9854a14eee..42791e6a71784b0f95daec4bba09e0f6e8266f00 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class TokenTest < Test::Unit::TestCase
+class TokenTest < ActiveSupport::TestCase
   fixtures :tokens
 
   def test_create
index 6dab8890c15ccf05f73d154263c14bf242a97a01..efc2aa7ed3e0248885acf0346aa63ee59c383904 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class TrackerTest < Test::Unit::TestCase
+class TrackerTest < ActiveSupport::TestCase
   fixtures :trackers, :workflows
 
   def test_copy_workflows
index cf6787b1789844f6e401ebe5b08cc2f5f5e3429c..19dc63ff838d127f39ff779aef6e25ed37716258 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class UserPreferenceTest < Test::Unit::TestCase
+class UserPreferenceTest < ActiveSupport::TestCase
   fixtures :users, :user_preferences
 
   def test_create
index 7080c0b5be423b700f34b1eef96d4488d2c79872..e685f53b6a1382eb8cba370da35ac925d3e96b4d 100644 (file)
@@ -17,7 +17,7 @@
 \r
 require File.dirname(__FILE__) + '/../test_helper'\r
 \r
-class UserTest < Test::Unit::TestCase\r
+class UserTest < ActiveSupport::TestCase\r
   fixtures :users, :members, :projects, :roles, :member_roles\r
 \r
   def setup\r
index 6c5297fc48e85cc4fb135439c7353c07e270ab41..7df8579273a467116af08d7989a672f628895047 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class VersionTest < Test::Unit::TestCase
+class VersionTest < ActiveSupport::TestCase
   fixtures :projects, :users, :issues, :issue_statuses, :trackers, :enumerations, :versions
 
   def setup
index 9566e6a7c7311afdea7039322cde1027ab8b235e..f49365edf83c0f4eb45fdbda2e85ca4077526e9a 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class WatcherTest < Test::Unit::TestCase
+class WatcherTest < ActiveSupport::TestCase
   fixtures :issues, :users
 
   def setup
index f3f8bc0414025a7f1b400a26df129fc4432fcc0e..372121bda0c30dbb427096f4c1a04dfeb9ff39c7 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class WikiContentTest < Test::Unit::TestCase
+class WikiContentTest < ActiveSupport::TestCase
   fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :users
 
   def setup
index df41a4a0ae3f01186cec5335609eacf7224a92e4..1837edb1864575688a089d07b132b089d7bb1ab4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class WikiPageTest < Test::Unit::TestCase
+class WikiPageTest < ActiveSupport::TestCase
   fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
 
   def setup
index 12f6b7d893c950ef4d2647c9224c677c7b2b2ac8..7e80638b2c235b4ccb7ea28cacf49edb274ec450 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class WikiRedirectTest < Test::Unit::TestCase
+class WikiRedirectTest < ActiveSupport::TestCase
   fixtures :projects, :wikis
 
   def setup
index 23d4f442c8dc0abe94fff0b96de2b37acf83205a..fd8a375e12881493fbd93107303680977ace6ad4 100644 (file)
@@ -17,7 +17,7 @@
 
 require File.dirname(__FILE__) + '/../test_helper'
 
-class WikiTest < Test::Unit::TestCase
+class WikiTest < ActiveSupport::TestCase
   fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
   \r
   def test_create\r
index b9640226c80217db4d81e5ff429cd76cc1f4ca18..6c621deeb43196df4c36a9302e9d010aad8b3359 100644 (file)
@@ -172,16 +172,29 @@ namespace :test do
   
   desc 'Update the plugin and tests files in the test application from the plugin'
   task :mirror_engine_files => [:test_app, :copy_engines_plugin] do
-    puts "> Modifying default config files to load engines plugin"
+    puts "> Tweaking generated application to be suitable for testing"
+    
+    # Replace the Rails plugin loader with the engines one.
     insert_line("require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')",
                 :into => 'config/environment.rb',
                 :after => "require File.join(File.dirname(__FILE__), 'boot')")
-                
-    insert_line('map.from_plugin :test_routing', :into => 'config/routes.rb', 
-                :after => /\AActionController::Routing::Routes/)
-                
+    
+    # Add the engines test helper to handle fixtures & stuff.
     insert_line("require 'engines_test_helper'", :into => 'test/test_helper.rb')
     
+    # Run engine plugin tests when running the application 
+    insert_line("task :test => ['test:engines:all']", :into => 'Rakefile')
+    
+    # We want exceptions to be raised
+    insert_line("def rescue_action(e) raise e end;", 
+                :into => "app/controllers/application_controller.rb",
+                :after => "class ApplicationController < ActionController::Base")
+    
+    # We need this method to test where actions are being rendered from.
+    insert_line("include RenderInformation", 
+                :into => "app/controllers/application_controller.rb",
+                :after => "class ApplicationController < ActionController::Base")
+    
     puts "> Mirroring test application files into #{test_app_dir}"
     mirror_test_files('app')
     mirror_test_files('lib')
index 619bd5a93cf201c8b057cdff410734a830c98c53..13f55ec9742d5f35e3ef68e0d12aee34e22f43b4 100644 (file)
@@ -4,4 +4,4 @@ homepage: http://www.rails-engines.org
 summary: Enhances the plugin mechanism to perform more flexible sharing
 description: The Rails Engines plugin allows the sharing of almost any type of code or asset that you could use in a Rails application, including controllers, models, stylesheets, and views.
 license: MIT
-version: 2.1.0
\ No newline at end of file
+version: 2.3.2
\ No newline at end of file
index f80f2b17b0e655c022c787a9319a872b25d2e7e4..1c55e213922d0943ffd99650cbe6096cb4aed30a 100644 (file)
@@ -1,7 +1,7 @@
 begin
   require 'rails/version'
-  unless Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 2 && Rails::VERSION::TINY >= 0
-    raise "This version of the engines plugin requires Rails 2.2.0 or later!"
+  unless Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 3 && Rails::VERSION::TINY >= 2
+    raise "This version of the engines plugin requires Rails 2.3.2 or later!"
   end
 end
 
index df94526321e9b132e4e144ec396d3b7e1f79edb5..28418166a228d7e3b7a7868c4f1726e563565dce 100644 (file)
@@ -1,5 +1,5 @@
 # Only call Engines.init once, in the after_initialize block so that Rails
 # plugin reloading works when turned on
 config.after_initialize do
-  Engines.init if defined? :Engines
-end
+  Engines.init(initializer) if defined? :Engines
+end
\ No newline at end of file
index cb97e4702b7897990a160c1b78f4296c82956f9b..d601710b08c93979e1b6c705ddc9289a13d5bab4 100644 (file)
@@ -43,7 +43,7 @@ module Engines
   
   # List of extensions to load, can be changed in init.rb before calling Engines.init
   mattr_accessor :rails_extensions
-  self.rails_extensions = %w(action_mailer asset_helpers form_tag_helpers routing migrations dependencies)
+  self.rails_extensions = %w(asset_helpers form_tag_helpers migrations dependencies)
   
   # The name of the public directory to mirror public engine assets into.
   # Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>.
@@ -68,7 +68,7 @@ module Engines
   mattr_accessor :disable_application_code_loading
   self.disable_application_code_loading = false
   
-  # Set this ti true if code should not be mixed (i.e. it will be loaded
+  # Set this to true if code should not be mixed (i.e. it will be loaded
   # from the first valid path on $LOAD_PATH)
   mattr_accessor :disable_code_mixing
   self.disable_code_mixing = false
@@ -81,7 +81,7 @@ module Engines
   self.code_mixing_file_types = %w(controller helper)
   
   class << self
-    def init
+    def init(initializer)
       load_extensions
       Engines::Assets.initialize_base_public_directory
     end
@@ -124,9 +124,9 @@ module Engines
     # and that they are placed within plugin/app/things (the pluralized form of 'thing').
     # 
     # It's important to note that you'll also want to ensure that the "things" are
-    # on your load path in your plugin's init.rb:
+    # on your load path by including them in Rails load path mechanism, e.g. in init.rb:
     #
-    #   Rails.plugins[:my_plugin].code_paths << "app/things"
+    #  ActiveSupport::Dependencies.load_paths << File.join(File.dirname(__FILE__), 'app', 'things'))
     #
     def mix_code_from(*types)
       self.code_mixing_file_types += types.map { |x| x.to_s.singularize }
index 488bcd4bc5dcd4cbec927ade980776e3633a691c..c52bbb0ce726aac670661dba23679ecf0e015ef2 100644 (file)
@@ -4,23 +4,9 @@
 #
 #   Engines.plugins[:plugin_name]
 #
-# If this plugin contains paths in directories other than <tt>app/controllers</tt>,
-# <tt>app/helpers</tt>, <tt>app/models</tt> and <tt>components</tt>, authors can
-# declare this by adding extra paths to #code_paths:
-#
-#    Rails.plugin[:my_plugin].code_paths << "app/sweepers" << "vendor/my_lib"
-#
 # Other properties of the Plugin instance can also be set.
 module Engines
   class Plugin < Rails::Plugin    
-    # Plugins can add code paths to this attribute in init.rb if they 
-    # need plugin directories to be added to the load path, i.e.
-    #
-    #   plugin.code_paths << 'app/other_classes'
-    #
-    # Defaults to ["app/controllers", "app/helpers", "app/models", "components"]
-    attr_accessor :code_paths
-
     # Plugins can add paths to this attribute in init.rb if they need
     # controllers loaded from additional locations. 
     attr_accessor :controller_paths
@@ -32,16 +18,6 @@ module Engines
     attr_accessor :public_directory   
     
     protected
-  
-      # The default set of code paths which will be added to $LOAD_PATH
-      # and Dependencies.load_paths
-      def default_code_paths
-        # lib will actually be removed from the load paths when we call
-        # uniq! in #inject_into_load_paths, but it's important to keep it
-        # around (for the documentation tasks, for instance).
-        %w(app/controllers app/helpers app/models components lib)
-      end
-    
       # The default set of code paths which will be added to the routing system
       def default_controller_paths
         %w(app/controllers components)
@@ -58,41 +34,23 @@ module Engines
   
     def initialize(directory)
       super directory
-      @code_paths = default_code_paths
       @controller_paths = default_controller_paths
       @public_directory = default_public_directory
     end
   
-    # Returns a list of paths this plugin wishes to make available in $LOAD_PATH
-    #
-    # Overwrites the correspondend method in the superclass  
-    def load_paths
-      report_nonexistant_or_empty_plugin! unless valid?
-      select_existing_paths :code_paths
-    end
-    
     # Extends the superclass' load method to additionally mirror public assets
     def load(initializer)
       return if loaded?
       super initializer
-      add_plugin_view_paths
       add_plugin_locale_paths
       Assets.mirror_files_for(self)
     end    
   
-    # for code_paths and controller_paths select those paths that actually 
-    # exist in the plugin's directory
+    # select those paths that actually exist in the plugin's directory
     def select_existing_paths(name)
       Engines.select_existing_paths(self.send(name).map { |p| File.join(directory, p) })
     end    
 
-    def add_plugin_view_paths
-      view_path = File.join(directory, 'app', 'views')
-      if File.exist?(view_path)
-        ActionController::Base.prepend_view_path(view_path) # push it just underneath the app
-      end
-    end
-
     def add_plugin_locale_paths
       locale_path = File.join(directory, 'locales')
       return unless File.exists?(locale_path)
@@ -112,11 +70,6 @@ module Engines
       "#{File.basename(Engines.public_directory)}/#{name}"
     end
     
-    # The path to this plugin's routes file
-    def routes_path
-      File.join(directory, "routes.rb")
-    end
-
     # The directory containing this plugin's migrations (<tt>plugin/db/migrate</tt>)
     def migration_directory
       File.join(self.directory, 'db', 'migrate')
index a5be5967bfe29f4b5a964dbcf96e2f05f3add5ff..e316e4750811aecf8e9e5527685bf38eed725ccb 100644 (file)
@@ -5,14 +5,7 @@ module Engines
         def register_plugin_as_loaded(plugin)
           super plugin
           Engines.plugins << plugin
-          register_to_routing(plugin)
         end    
-        
-        # Registers the plugin's controller_paths for the routing system. 
-        def register_to_routing(plugin)
-          initializer.configuration.controller_paths += plugin.select_existing_paths(:controller_paths)
-          initializer.configuration.controller_paths.uniq!
-        end
     end
   end
 end
\ No newline at end of file
diff --git a/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb b/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb
deleted file mode 100644 (file)
index 32198d8..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-# The way ActionMailer is coded in terms of finding templates is very restrictive, to the point
-# where all templates for rendering must exist under the single base path. This is difficult to
-# work around without re-coding significant parts of the action mailer code.
-#
-# ---
-#
-# The MailTemplates module overrides two (private) methods from ActionMailer to enable mail 
-# templates within plugins:
-#
-# [+template_path+]             which now produces the contents of #template_paths
-# [+initialize_template_class+] which now find the first matching template and creates 
-#                               an ActionVew::Base instance with the correct view_paths
-#
-# Ideally ActionMailer would use the same template-location logic as ActionView, and the same
-# view paths as ActionController::Base.view_paths, but it currently does not.
-module Engines::RailsExtensions::ActionMailer
-  def self.included(base) #:nodoc:
-    base.class_eval do
-      alias_method_chain :template_path, :engine_additions
-      alias_method_chain :initialize_template_class, :engine_additions
-    end
-  end
-
-  private
-  
-    #--
-    # ActionMailer::Base#create uses two mechanisms to determine the proper template file(s)
-    # to load. Firstly, it searches within the template_root for files that much the explicit
-    # (or implicit) part encodings (like signup.text.plain.erb for the signup action). 
-    # This is how implicit multipart emails are built, by the way.
-    #
-    # Secondly, it then creates an ActionMailer::Base instance with it's view_paths parameter
-    # set to the template_root, so that ActionMailer will then take over rendering the
-    # templates.
-    #
-    # Ideally, ActionMailer would pass the same set of view paths as it gets in a normal
-    # request (i.e. ActionController::Base.view_paths), so that all possible view paths
-    # were searched. However, this seems to introduce some problems with helper modules.
-    #
-    # So instead, and because we have to fool these two independent parts of ActionMailer,
-    # we fudge with the mechanisms it uses to find the templates (via template_paths, and
-    # template_path_with_engine_additions), and then intercept the creation of the ActionView
-    # instance so we can set the view_paths (in initialize_template_class_with_engine_additions).
-    #++
-  
-    # Returns all possible template paths for the current mailer, including those
-    # within the loaded plugins.
-    def template_paths
-      paths = Engines.plugins.by_precedence.map { |p| "#{p.directory}/app/views/#{mailer_name}" }
-      paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading
-      paths
-    end
-
-    # Return something that Dir[] can glob against. This method is called in 
-    # ActionMailer::Base#create! and used as part of an argument to Dir. We can
-    # take advantage of this by using some of the features of Dir.glob to search
-    # multiple paths for matching files.
-    def template_path_with_engine_additions
-      "{#{template_paths.join(",")}}"
-    end
-
-    # Return an instance of ActionView::Base with the view paths set to all paths
-    # in ActionController::Base.view_paths (i.e. including all plugin view paths)
-    def initialize_template_class_with_engine_additions(assigns)
-      # I'd like to just return this, but I get problems finding methods in helper
-      # modules if the method implemention from the regular class is not called
-      # 
-      # ActionView::Base.new(ActionController::Base.view_paths.dup, assigns, self)
-      renderer = initialize_template_class_without_engine_additions(assigns)
-      renderer.view_paths.unshift(*ActionController::Base.view_paths.dup)
-      renderer
-    end
-end
-
-# We don't need to do this if ActionMailer hasn't been loaded.
-if Object.const_defined?(:ActionMailer) 
-  module ::ActionMailer #:nodoc:
-    class Base #:nodoc:
-      include Engines::RailsExtensions::ActionMailer
-    end
-  end
-end
\ No newline at end of file
diff --git a/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb b/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb
deleted file mode 100644 (file)
index aed85ff..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# Effective use of Rails' routes can help create a tidy and elegant set of URLs,
-# and is a significant part of creating an external API for your web application.
-# 
-# When developing plugins which contain controllers, it seems obvious that including
-# the corresponding routes would be extremely useful. This is particularly true
-# when exposing RESTful resources using the new REST-ian features of Rails.
-#
-# == Including routes in your plugin
-#
-# The engines plugin makes it possible to include a set of routes within your plugin
-# very simply, as it turns out. Include a <tt>routes.rb</tt> file like the one below 
-# at the root of your plugin (along-side <tt>init.rb</tt> and <tt>lib/</tt>):
-# 
-#   connect "/login", :controller => "account", :action => "login"
-#
-#   # add a named route
-#   logout "/logout", :controller => "account", :action => "logout"
-#
-#   # some restful stuff
-#   resources :things do |t|
-#     t.resources :other_things
-#   end
-# 
-# Everywhere in a normal <tt>RAILS_ROOT/config/routes.rb</tt> file 
-# where you might have <tt>map.connect</tt>, you just use <tt>connect</tt> in your 
-# plugin's <tt>routes.rb</tt>.
-# 
-# === Hooking it up in your application
-#
-# While it would be possible to have each plugin's routes automagically included into
-# the application's route set, to do so would actually be a stunningly bad idea. Route
-# priority is the key issue here. You, the application developer, needs to be in complete
-# control when it comes to specifying the priority of routes in your application, since 
-# the ordering of your routes directly affects how Rails will interpret incoming requests.
-# 
-# To add plugin routes into your application's <tt>routes.rb</tt> file, you need to explicitly 
-# map them in using the Engines::RailsExtensions::Routing#from_plugin method:
-# 
-#   ApplicationController::Routing::Routes.draw do |map|
-#
-#     map.connect "/app_stuff", :controller => "application_thing" # etc...
-#
-#     # This line includes the routes from the given plugin at this point, giving you
-#     # control over the priority of your application routes 
-#     map.from_plugin :your_plugin
-#
-#     map.connect ":controller/:action/:id"
-#   end
-# 
-# By including routes in plugins which have controllers, you can now share in a simple way 
-# a compact and elegant URL scheme which corresponds to those controllers.
-#
-# ---
-#
-# The Engines::RailsExtensions::Routing module defines extensions to Rails' 
-# routing (ActionController::Routing) mechanism such that routes can be loaded 
-# from a given plugin.
-#
-# The key method is Engines::RailsExtensions::Routing#from_plugin, which can be called 
-# within your application's <tt>config/routes.rb</tt> file to load plugin routes at that point.
-#
-module Engines::RailsExtensions::Routing
-  # Loads the set of routes from within a plugin and evaluates them at this
-  # point within an application's main <tt>routes.rb</tt> file.
-  #
-  # Plugin routes are loaded from <tt><plugin_root>/routes.rb</tt>.
-  def from_plugin(name)
-    map = self # to make 'map' available within the plugin route file
-    routes_path = Engines.plugins[name].routes_path
-    eval(IO.read(routes_path), binding, routes_path) if File.file?(routes_path)
-  end
-end
-
-  
-module ::ActionController #:nodoc:
-  module Routing #:nodoc:
-    class RouteSet #:nodoc:
-      class Mapper #:nodoc:
-        include Engines::RailsExtensions::Routing
-      end
-    end
-  end
-end
index f7833c385a3667dd4d2c8aa1d0765f8bb380f6b9..c411f8335bcee3c9466fff624b5dd7a4cafc163f 100644 (file)
@@ -67,10 +67,14 @@ module Engines::Testing
   # This method is called by the engines-supplied plugin testing rake tasks
   def self.setup_plugin_fixtures(plugins = Engines.plugins.by_precedence)
     
+    # First, clear the directory
+    Dir.glob("#{self.temporary_fixtures_directory}/*.yml").each{|fixture| File.delete(fixture)}
+    
     # Copy all plugin fixtures, and then the application fixtures, into this directory
     plugins.each do |plugin| 
       plugin_fixtures_directory =  File.join(plugin.directory, "test", "fixtures")
-      if File.directory?(plugin_fixtures_directory)
+      plugin_app_directory =  File.join(plugin.directory, "app")
+      if File.directory?(plugin_app_directory) && File.directory?(plugin_fixtures_directory)
         Engines.mirror_files_from(plugin_fixtures_directory, self.temporary_fixtures_directory)
       end
     end
@@ -84,4 +88,14 @@ module Engines::Testing
     ActiveSupport::TestCase.fixture_path = self.temporary_fixtures_directory
     $LOAD_PATH.unshift self.temporary_fixtures_directory
   end
+  
+  # overridden test should be in test/{unit,functional,integration}/{plugin_name}/{test_name}
+  def self.override_tests_from_app
+    filename = caller.first.split(":").first
+    plugin_name = filename.split("/")[-4]
+    test_kind = filename.split("/")[-2]
+    override_file = File.expand_path(File.join(File.dirname(filename), "..", "..", "..", "..", "..", "test", 
+                                               test_kind, plugin_name, File.basename(filename)))
+    load(override_file) if File.exist?(override_file)
+  end
 end
\ No newline at end of file
index 0ffd7e6e716e1399758daf2c7b2446ce18c286e0..48e3170666f1c5bda19c9a7483fdfe3652fe8c44 100644 (file)
@@ -118,10 +118,10 @@ namespace :db do
     end
     
     desc 'Migrate a specified plugin.'
-    task({:plugin => :environment}, :name, :version) do |task, args|
-      name = args[:name] || ENV['NAME']
+    task(:plugin => :environment) do
+      name = ENV['NAME']
       if plugin = Engines.plugins[name]
-        version = args[:version] || ENV['VERSION']
+        version = ENV['VERSION']
         puts "Migrating #{plugin.name} to " + (version ? "version #{version}" : 'latest version') + " ..."
         plugin.migrate(version ? version.to_i : nil)
       else
@@ -152,8 +152,8 @@ end
 
 # this is just a modification of the original task in railties/lib/tasks/documentation.rake, 
 # because the default task doesn't support subdirectories like <plugin>/app or
-# <plugin>/component. These tasks now include every file under a plugin's code paths (see
-# Plugin#code_paths).
+# <plugin>/component. These tasks now include every file under a plugin's load paths (see
+# Plugin#load_paths).
 namespace :doc do
 
   plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }
@@ -172,9 +172,9 @@ namespace :doc do
         options << '--line-numbers' << '--inline-source'
         options << '-T html'
 
-        # Include every file in the plugin's code_paths (see Plugin#code_paths)
+        # Include every file in the plugin's load_paths (see Plugin#load_paths)
         if Engines.plugins[plugin]
-          files.include("#{plugin_base}/{#{Engines.plugins[plugin].code_paths.join(",")}}/**/*.rb")
+          files.include("#{plugin_base}/{#{Engines.plugins[plugin].load_paths.join(",")}}/**/*.rb")
         end
         if File.exists?("#{plugin_base}/README")
           files.include("#{plugin_base}/README")    
@@ -217,6 +217,34 @@ Report any issues on http://dev.rails-engines.org. Thanks!
 -~===============( ... as you were ... )============================~-}
   end
   
+  namespace :engines do
+    
+    def engine_plugins
+      Dir["vendor/plugins/*"].select { |f| File.directory?(File.join(f, "app")) }.map { |f| File.basename(f) }.join(",")
+    end
+    
+    desc "Run tests from within engines plugins (plugins with an 'app' directory)"
+    task :all => [:units, :functionals, :integration]
+    
+    desc "Run unit tests from within engines plugins (plugins with an 'app' directory)"
+    Rake::TestTask.new(:units => "test:plugins:setup_plugin_fixtures") do |t|
+      t.pattern = "vendor/plugins/{#{ENV['PLUGIN'] || engine_plugins}}/test/unit/**/*_test.rb"
+      t.verbose = true
+    end
+
+    desc "Run functional tests from within engines plugins (plugins with an 'app' directory)"
+    Rake::TestTask.new(:functionals => "test:plugins:setup_plugin_fixtures") do |t|
+      t.pattern = "vendor/plugins/{#{ENV['PLUGIN'] || engine_plugins}}/test/functional/**/*_test.rb"
+      t.verbose = true
+    end
+
+    desc "Run integration tests from within engines plugins (plugins with an 'app' directory)"
+    Rake::TestTask.new(:integration => "test:plugins:setup_plugin_fixtures") do |t|
+      t.pattern = "vendor/plugins/{#{ENV['PLUGIN'] || engine_plugins}}/test/integration/**/*_test.rb"
+      t.verbose = true
+    end
+  end
+  
   namespace :plugins do
 
     desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
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 (file)
index 0000000..90b13ff
--- /dev/null
@@ -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 (file)
index 0000000..05f9049
--- /dev/null
@@ -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 (file)
index 0000000..9e081e7
--- /dev/null
@@ -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 (file)
index 0000000..f0fe903
--- /dev/null
@@ -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 (file)
index 0000000..899fc1a
--- /dev/null
@@ -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 (file)
index 0000000..ae6fbbf
--- /dev/null
@@ -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 (file)
index 0000000..03e2bf8
--- /dev/null
@@ -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 (file)
index 0000000..03e2bf8
--- /dev/null
@@ -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 (file)
index 0000000..042b5c4
--- /dev/null
@@ -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 (file)
index 0000000..552acc1
--- /dev/null
@@ -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 (file)
index 0000000..135488b
--- /dev/null
@@ -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 (file)
index 0000000..e005046
--- /dev/null
@@ -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 (file)
index 0000000..5aaf46e
--- /dev/null
@@ -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 (file)
index 0000000..67a6b8f
--- /dev/null
@@ -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 (file)
index 0000000..284e450
--- /dev/null
@@ -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 (file)
index 0000000..d51bc00
--- /dev/null
@@ -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 (file)
index 0000000..3093306
--- /dev/null
@@ -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 (file)
index 0000000..21c8c7f
--- /dev/null
@@ -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 (file)
index 0000000..733dd39
--- /dev/null
@@ -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 (file)
index 0000000..5448ffe
--- /dev/null
@@ -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 (file)
index 0000000..28d4754
--- /dev/null
@@ -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 (file)
index 0000000..6ffe178
--- /dev/null
@@ -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 (file)
index 0000000..47bd2bb
--- /dev/null
@@ -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 (file)
index 0000000..0deb5d9
--- /dev/null
@@ -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 (file)
index 0000000..736d59b
--- /dev/null
@@ -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 (file)
index 0000000..c41d6ed
--- /dev/null
@@ -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 (file)
index 0000000..5edf81b
--- /dev/null
@@ -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 (file)
index 0000000..7431a36
--- /dev/null
@@ -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 (file)
index 0000000..fb162bc
--- /dev/null
@@ -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 (file)
index 0000000..00539bb
--- /dev/null
@@ -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 (file)
index 0000000..cde71b8
--- /dev/null
@@ -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 (file)
index 0000000..92e6e62
--- /dev/null
@@ -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 (file)
index 0000000..e2ef43d
--- /dev/null
@@ -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 (file)
index 0000000..1ad6945
--- /dev/null
@@ -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 (file)
index 0000000..791a6fa
--- /dev/null
@@ -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 (file)
index 0000000..878e07c
--- /dev/null
@@ -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 (file)
index 0000000..1ad6945
--- /dev/null
@@ -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 (file)
index 0000000..1ad6945
--- /dev/null
@@ -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 (file)
index 0000000..f144ab3
--- /dev/null
@@ -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 (file)
index 0000000..f144ab3
--- /dev/null
@@ -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 (file)
index 0000000..0ce4f91
--- /dev/null
@@ -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 (file)
index 0000000..645a70c
--- /dev/null
@@ -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 (file)
index 0000000..76d39d3
--- /dev/null
@@ -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 (file)
index 0000000..2e77989
--- /dev/null
@@ -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 (file)
index 0000000..971c7d5
--- /dev/null
@@ -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 (file)
index 0000000..ddd9dbe
--- /dev/null
@@ -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 (file)
index 0000000..bfde227
--- /dev/null
@@ -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 (file)
index 0000000..77b5a15
--- /dev/null
@@ -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 (file)
index 0000000..77b5a15
--- /dev/null
@@ -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 (file)
index 0000000..b4c4b0e
--- /dev/null
@@ -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 (file)
index 0000000..f49279c
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..db5de2e
--- /dev/null
@@ -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 (file)
index 0000000..8340f76
--- /dev/null
@@ -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 (file)
index 0000000..b7da375
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..535d988
--- /dev/null
@@ -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 (file)
index 0000000..b4c4b0e
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..804a0cd
--- /dev/null
@@ -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 (file)
index 0000000..756aca6
--- /dev/null
@@ -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 (file)
index 0000000..fb5b6c2
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..4f36616
--- /dev/null
@@ -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 (file)
index 0000000..2b49606
--- /dev/null
@@ -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 (file)
index 0000000..46291d8
--- /dev/null
@@ -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 (file)
index 0000000..f690dba
--- /dev/null
@@ -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 (file)
index 0000000..795f0d5
--- /dev/null
@@ -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 (file)
index 0000000..795f0d5
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..29d7bdb
--- /dev/null
@@ -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 (file)
index 0000000..ac3164a
--- /dev/null
@@ -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 (file)
index 0000000..dbc49f9
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..784e4fe
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..4c4c42a
--- /dev/null
@@ -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 (file)
index 0000000..fc3e756
--- /dev/null
@@ -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 (file)
index 0000000..4b862f3
--- /dev/null
@@ -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 (file)
index 0000000..3332c53
--- /dev/null
@@ -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 (file)
index 0000000..4fa3698
--- /dev/null
@@ -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 (file)
index 0000000..c26d331
--- /dev/null
@@ -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 (file)
index 0000000..eae7fe7
--- /dev/null
@@ -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 (file)
index 0000000..e5aa773
--- /dev/null
@@ -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 (file)
index 0000000..f8627bc
--- /dev/null
@@ -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 (file)
index 0000000..ea58a51
--- /dev/null
@@ -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 (file)
index 0000000..c0c37ed
--- /dev/null
@@ -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
diff --git a/vendor/plugins/prepend_engine_views/init.rb b/vendor/plugins/prepend_engine_views/init.rb
new file mode 100644 (file)
index 0000000..cbf0e89
--- /dev/null
@@ -0,0 +1,21 @@
+module PrependEngineViews
+  def self.included(base)
+    base.send(:include, InstanceMethods)
+    base.class_eval do
+      alias_method_chain :add_engine_view_paths, :prepend
+    end
+  end
+
+  module InstanceMethods
+    # Patch Rails so engine's views are prepended to the view_path,
+    # thereby letting plugins override application views
+    def add_engine_view_paths_with_prepend
+      paths = ActionView::PathSet.new(engines.collect(&:view_path))
+      ActionController::Base.view_paths.unshift(*paths)
+      ActionMailer::Base.view_paths.unshift(*paths) if configuration.frameworks.include?(:action_mailer)
+    end
+  end
+end
+
+Rails::Plugin::Loader.send :include, PrependEngineViews
+