diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-24 11:11:08 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-24 11:11:08 +0100 |
commit | f3f67ce6212e2ae35470ab2960bb4967ae967ee2 (patch) | |
tree | 6a3054b9e4882a3faea6acc8b935db16a0831c4e /actionpack/test | |
parent | eea5dc3a34328267407f2cb861e14d9d1f5d7c02 (diff) | |
parent | 2dd0ec48a5068a095e362fad2a77d63b86fdfd95 (diff) | |
download | rails-f3f67ce6212e2ae35470ab2960bb4967ae967ee2.tar.gz rails-f3f67ce6212e2ae35470ab2960bb4967ae967ee2.tar.bz2 rails-f3f67ce6212e2ae35470ab2960bb4967ae967ee2.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/abstract_unit.rb | 2 | ||||
-rw-r--r-- | actionpack/test/activerecord/active_record_store_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/assert_select_test.rb | 5 | ||||
-rw-r--r-- | actionpack/test/controller/cgi_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/dispatcher_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/integration_upload_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/rack_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/request_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/session/cookie_store_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/session/mem_cache_store_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/template/form_options_helper_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/template/number_helper_i18n_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 11 |
15 files changed, 20 insertions, 21 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 76812b94df..bee598e1ef 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -8,7 +8,7 @@ require 'yaml' require 'stringio' require 'test/unit' -gem 'mocha', '>= 0.9.0' +gem 'mocha', '>= 0.9.3' require 'mocha' begin diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index fd7da89aa7..677d434f9c 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -1,7 +1,6 @@ # These tests exercise CGI::Session::ActiveRecordStore, so you're going to # need AR in a sibling directory to AP and have SQLite installed. require 'active_record_unit' -require 'action_controller/session/active_record_store' module CommonActiveRecordStoreTests def test_basics diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index a79278159d..ed8c4427c9 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -9,9 +9,10 @@ require 'controller/fake_controllers' unless defined?(ActionMailer) begin - $:.unshift(File.dirname(__FILE__) + "/../../../actionmailer/lib") + $:.unshift("#{File.dirname(__FILE__)}/../../../actionmailer/lib") require 'action_mailer' - rescue LoadError + rescue LoadError => e + raise unless e.message =~ /action_mailer/ require 'rubygems' gem 'actionmailer' end diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index 87fbf1a4cd..ac1c8abc59 100644 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -1,5 +1,4 @@ require 'abstract_unit' -require 'action_controller/cgi_process' class BaseCgiTest < Test::Unit::TestCase def setup diff --git a/actionpack/test/controller/dispatcher_test.rb b/actionpack/test/controller/dispatcher_test.rb index 3ee78a6156..61bfb2b6e9 100644 --- a/actionpack/test/controller/dispatcher_test.rb +++ b/actionpack/test/controller/dispatcher_test.rb @@ -2,8 +2,6 @@ require 'abstract_unit' uses_mocha 'dispatcher tests' do -require 'action_controller/dispatcher' - class DispatcherTest < Test::Unit::TestCase Dispatcher = ActionController::Dispatcher diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 7e4c3e171a..b39d35930d 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -1,6 +1,4 @@ require 'abstract_unit' -require 'action_controller/integration' -require 'action_controller/routing' uses_mocha 'integration' do diff --git a/actionpack/test/controller/integration_upload_test.rb b/actionpack/test/controller/integration_upload_test.rb index 4af9b7e697..b1dd6a6341 100644 --- a/actionpack/test/controller/integration_upload_test.rb +++ b/actionpack/test/controller/integration_upload_test.rb @@ -1,6 +1,4 @@ require 'abstract_unit' -require 'action_controller/integration' -require 'action_controller/routing' unless defined? ApplicationController class ApplicationController < ActionController::Base diff --git a/actionpack/test/controller/rack_test.rb b/actionpack/test/controller/rack_test.rb index d5e56b9584..7e8b0f9bf2 100644 --- a/actionpack/test/controller/rack_test.rb +++ b/actionpack/test/controller/rack_test.rb @@ -1,5 +1,4 @@ require 'abstract_unit' -require 'action_controller/rack_process' class BaseRackTest < Test::Unit::TestCase def setup diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 7e264289e6..316a203e97 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -1,5 +1,4 @@ require 'abstract_unit' -require 'action_controller/integration' class RequestTest < ActiveSupport::TestCase def setup diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index b8a143cfd9..d62c7a1743 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -1,6 +1,5 @@ require 'abstract_unit' require 'controller/fake_controllers' -require 'action_controller/routing' class MilestonesController < ActionController::Base def index() head :ok end diff --git a/actionpack/test/controller/session/cookie_store_test.rb b/actionpack/test/controller/session/cookie_store_test.rb index 52c1f7559c..b5f14acc1f 100644 --- a/actionpack/test/controller/session/cookie_store_test.rb +++ b/actionpack/test/controller/session/cookie_store_test.rb @@ -1,7 +1,4 @@ require 'abstract_unit' -require 'action_controller/cgi_process' -require 'action_controller/cgi_ext' - require 'stringio' diff --git a/actionpack/test/controller/session/mem_cache_store_test.rb b/actionpack/test/controller/session/mem_cache_store_test.rb index a7d48431f8..9ab927a01f 100644 --- a/actionpack/test/controller/session/mem_cache_store_test.rb +++ b/actionpack/test/controller/session/mem_cache_store_test.rb @@ -1,7 +1,4 @@ require 'abstract_unit' -require 'action_controller/cgi_process' -require 'action_controller/cgi_ext' - class CGI::Session def cache diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index a33eb85b66..86a0bb6a79 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'tzinfo' TZInfo::Timezone.cattr_reader :loaded_zones @@ -682,4 +683,4 @@ uses_mocha "FormOptionsHelperTest" do end end -end
\ No newline at end of file +end diff --git a/actionpack/test/template/number_helper_i18n_test.rb b/actionpack/test/template/number_helper_i18n_test.rb index 67c61a5f2e..2528bead36 100644 --- a/actionpack/test/template/number_helper_i18n_test.rb +++ b/actionpack/test/template/number_helper_i18n_test.rb @@ -10,6 +10,7 @@ class NumberHelperI18nTests < Test::Unit::TestCase @number_defaults = { :precision => 3, :delimiter => ',', :separator => '.' } @currency_defaults = { :unit => '$', :format => '%u%n', :precision => 2 } @human_defaults = { :precision => 1 } + @human_storage_units_defaults = %w(Bytes KB MB GB TB) @percentage_defaults = { :delimiter => '' } @precision_defaults = { :delimiter => '' } @@ -47,6 +48,8 @@ class NumberHelperI18nTests < Test::Unit::TestCase I18n.expects(:translate).with(:'number.format', :locale => 'en', :raise => true).returns(@number_defaults) I18n.expects(:translate).with(:'number.human.format', :locale => 'en', :raise => true).returns(@human_defaults) + I18n.expects(:translate).with(:'number.human.storage_units', :locale => 'en', + :raise => true).returns(@human_storage_units_defaults) # can't be called with 1 because this directly returns without calling I18n.translate number_to_human_size(1025, :locale => 'en') end diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 0323c33b95..b316d5c23e 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -175,6 +175,17 @@ class ViewRenderTest < Test::Unit::TestCase assert_equal 'source: "Hello, <%= name %>!"', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo) end + class LegacyHandler < ActionView::TemplateHandler + def render(template, local_assigns) + "source: #{template.source}; locals: #{local_assigns.inspect}" + end + end + + def test_render_legacy_handler_with_custom_type + ActionView::Template.register_template_handler :foo, LegacyHandler + assert_equal 'source: Hello, <%= name %>!; locals: {:name=>"Josh"}', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo) + end + def test_render_with_layout assert_equal %(<title></title>\nHello world!\n), @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield") |