aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-03-26 17:30:13 +0430
committerwycats <wycats@gmail.com>2010-03-27 00:26:44 -0700
commit167017f65558a4461aaf8dc26a6f329a283366c2 (patch)
tree805e5f34828d147887accb318e48ea26ba298aba
parent3d746fcdb584767c476408f395320e934fd5383e (diff)
downloadrails-167017f65558a4461aaf8dc26a6f329a283366c2.tar.gz
rails-167017f65558a4461aaf8dc26a6f329a283366c2.tar.bz2
rails-167017f65558a4461aaf8dc26a6f329a283366c2.zip
Tests method_missing to raise NameError. [#2522 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
-rw-r--r--actionpack/test/controller/base_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 8b935097da..49f79681f6 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -56,6 +56,16 @@ protected
end
end
+class AnotherMethodMissingController < ActionController::Base
+ cattr_accessor :_exception
+ rescue_from Exception, :with => :_exception=
+
+ protected
+ def method_missing(*attrs, &block)
+ super
+ end
+end
+
class DefaultUrlOptionsController < ActionController::Base
def from_view
render :inline => "<%= #{params[:route]} %>"
@@ -173,6 +183,12 @@ class PerformActionTest < ActionController::TestCase
assert_equal 'method_missing', @response.body
end
+ def test_method_missing_should_recieve_symbol
+ use_controller AnotherMethodMissingController
+ get :some_action
+ assert_kind_of NameError, @controller._exception
+ end
+
def test_get_on_hidden_should_fail
use_controller NonEmptyController
assert_raise(ActionController::UnknownAction) { get :hidden_action }