diff options
author | Hongli Lai (Phusion) <hongli@phusion.nl> | 2008-12-03 19:30:35 +0100 |
---|---|---|
committer | Hongli Lai (Phusion) <hongli@phusion.nl> | 2008-12-03 19:30:35 +0100 |
commit | ccb96f2297e8783165cba764e9b5d51e1a15ff87 (patch) | |
tree | 3229e6fdddc42054615514d843c555e341003033 /actionpack/test/controller/components_test.rb | |
parent | fb2325e35855d62abd2c76ce03feaa3ca7992e4f (diff) | |
parent | 761a633a9c0a45d76ef3ed10da97e3696c3ded79 (diff) | |
download | rails-ccb96f2297e8783165cba764e9b5d51e1a15ff87.tar.gz rails-ccb96f2297e8783165cba764e9b5d51e1a15ff87.tar.bz2 rails-ccb96f2297e8783165cba764e9b5d51e1a15ff87.zip |
Merge commit 'origin/master' into savepoints
Conflicts:
activerecord/lib/active_record/fixtures.rb
activerecord/test/cases/defaults_test.rb
Diffstat (limited to 'actionpack/test/controller/components_test.rb')
-rw-r--r-- | actionpack/test/controller/components_test.rb | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/actionpack/test/controller/components_test.rb b/actionpack/test/controller/components_test.rb deleted file mode 100644 index 4d36fc411d..0000000000 --- a/actionpack/test/controller/components_test.rb +++ /dev/null @@ -1,156 +0,0 @@ -require 'abstract_unit' - -class CallerController < ActionController::Base - def calling_from_controller - render_component(:controller => "callee", :action => "being_called") - end - - def calling_from_controller_with_params - render_component(:controller => "callee", :action => "being_called", :params => { "name" => "David" }) - end - - def calling_from_controller_with_different_status_code - render_component(:controller => "callee", :action => "blowing_up") - end - - def calling_from_template - render :inline => "Ring, ring: <%= render_component(:controller => 'callee', :action => 'being_called') %>" - end - - def internal_caller - render :inline => "Are you there? <%= render_component(:action => 'internal_callee') %>" - end - - def internal_callee - render :text => "Yes, ma'am" - end - - def set_flash - render_component(:controller => "callee", :action => "set_flash") - end - - def use_flash - render_component(:controller => "callee", :action => "use_flash") - end - - def calling_redirected - render_component(:controller => "callee", :action => "redirected") - end - - def calling_redirected_as_string - render :inline => "<%= render_component(:controller => 'callee', :action => 'redirected') %>" - end - - def rescue_action(e) raise end -end - -class CalleeController < ActionController::Base - def being_called - render :text => "#{params[:name] || "Lady"} of the House, speaking" - end - - def blowing_up - render :text => "It's game over, man, just game over, man!", :status => 500 - end - - def set_flash - flash[:notice] = 'My stoney baby' - render :text => 'flash is set' - end - - def use_flash - render :text => flash[:notice] || 'no flash' - end - - def redirected - redirect_to :controller => "callee", :action => "being_called" - end - - def rescue_action(e) raise end -end - -class ComponentsTest < Test::Unit::TestCase - def setup - @controller = CallerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - end - - def test_calling_from_controller - assert_deprecated do - get :calling_from_controller - assert_equal "Lady of the House, speaking", @response.body - end - end - - def test_calling_from_controller_with_params - assert_deprecated do - get :calling_from_controller_with_params - assert_equal "David of the House, speaking", @response.body - end - end - - def test_calling_from_controller_with_different_status_code - assert_deprecated do - get :calling_from_controller_with_different_status_code - assert_equal 500, @response.response_code - end - end - - def test_calling_from_template - assert_deprecated do - get :calling_from_template - assert_equal "Ring, ring: Lady of the House, speaking", @response.body - end - end - - def test_etag_is_set_for_parent_template_when_calling_from_template - assert_deprecated do - get :calling_from_template - expected_etag = etag_for("Ring, ring: Lady of the House, speaking") - assert_equal expected_etag, @response.headers['ETag'] - end - end - - def test_internal_calling - assert_deprecated do - get :internal_caller - assert_equal "Are you there? Yes, ma'am", @response.body - end - end - - def test_flash - assert_deprecated do - get :set_flash - assert_equal 'My stoney baby', flash[:notice] - get :use_flash - assert_equal 'My stoney baby', @response.body - get :use_flash - assert_equal 'no flash', @response.body - end - end - - def test_component_redirect_redirects - assert_deprecated do - get :calling_redirected - assert_redirected_to :controller=>"callee", :action => "being_called" - end - end - - def test_component_multiple_redirect_redirects - test_component_redirect_redirects - test_internal_calling - end - - def test_component_as_string_redirect_renders_redirected_action - assert_deprecated do - get :calling_redirected_as_string - assert_equal "Lady of the House, speaking", @response.body - end - end - - protected - def etag_for(text) - %("#{Digest::MD5.hexdigest(text)}") - end -end |