Permalink
Browse files

Make IntegrationTest refer to superclass properties using copy-on-write

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3810 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 31a499a commit 4d4f0e6490e0523c4bf45e433e9d27ac9ce4da1e @jamis jamis committed Mar 7, 2006
Showing with 31 additions and 0 deletions.
  1. +31 −0 actionpack/lib/action_controller/integration_test.rb
View
31 actionpack/lib/action_controller/integration_test.rb
@@ -414,6 +414,37 @@ def run(*args) #:nodoc:
super
end
+ # Because of how use_instantiated_fixtures and use_transactional_fixtures
+ # are defined, we need to treat them as special cases. Otherwise, users
+ # would potentially have to set their values for both Test::Unit::TestCase
+ # ActionController::IntegrationTest, since by the time the value is set on
+ # TestCase, IntegrationTest has already been defined and cannot inherit
+ # changes to those variables. So, we make those two attributes copy-on-write.
+
+ class<<self
+ def use_transactional_fixtures=(flag) #:nodoc:
+ @_use_transactional_fixtures = true
+ @use_transactional_fixtures = flag
+ end
+
+ def use_instantiated_fixtures=(flag) #:nodoc:
+ @_use_instantiated_fixtures = true
+ @use_instantiated_fixtures = flag
+ end
+
+ def use_transactional_fixtures #:nodoc:
+ @_use_transactional_fixtures ?
+ @use_transactional_fixtures :
+ superclass.use_transactional_fixtures
+ end
+
+ def use_instantiated_fixtures #:nodoc:
+ @_use_instantiated_fixtures ?
+ @use_instantiated_fixtures :
+ superclass.use_instantiated_fixtures
+ end
+ end
+
# Reset the current session. This is useful for testing multiple sessions
# in a single test case.
def reset!

0 comments on commit 4d4f0e6

Please sign in to comment.