diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-28 05:21:24 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-28 05:21:24 +0000 |
commit | 16558f6dd83d514f783ed13e9bc24d6b66e5aefd (patch) | |
tree | 79769c2be74da20de923b10202bc6e128da036a8 /actionpack/lib | |
parent | 0c0610d398a89f5a74c9fee593eee1bb10975a46 (diff) | |
download | rails-16558f6dd83d514f783ed13e9bc24d6b66e5aefd.tar.gz rails-16558f6dd83d514f783ed13e9bc24d6b66e5aefd.tar.bz2 rails-16558f6dd83d514f783ed13e9bc24d6b66e5aefd.zip |
Ensure that test case setup is run even if overridden. Closes #10382.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8497 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index d81cb5dae3..84610c34c0 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -44,10 +44,23 @@ module ActionController end end - def setup + def setup_with_controller @controller = self.class.controller_class.new @request = TestRequest.new @response = TestResponse.new end - end -end
\ No newline at end of file + alias_method :setup, :setup_with_controller + + def self.method_added(method) + if method.to_s == 'setup' + unless method_defined?(:setup_without_controller) + alias_method :setup_without_controller, :setup + define_method(:setup) do + setup_with_controller + setup_without_controller + end + end + end + end + end +end |