Permalink
Browse files

Fix fixtures in integration test sessions

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
1 parent e8b84ab commit a159fd0b8cda70140ef42990992da16797dcfd36 @akaspick akaspick committed with NZKoz Aug 4, 2010
Showing with 19 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_controller/integration.rb
  2. +18 −0 actionpack/test/controller/integration_test.rb
@@ -536,7 +536,7 @@ def open_session(application = nil)
if self.class.respond_to?(:fixture_table_names)
self.class.fixture_table_names.each do |table_name|
name = table_name.tr(".", "_")
- next unless respond_to?(name)
+ next unless respond_to?(name, true)
extras.__send__(:define_method, name) { |*args|
delegate.send(name, *args)
}
@@ -227,6 +227,24 @@ def method_missing(name, *args)
end
end
+require 'active_record_unit'
+# Tests that fixtures are accessible in the integration test sessions
+class IntegrationTestWithFixtures < ActiveRecordTestCase
+ include ActionController::Integration::Runner
+
+ fixtures :companies
+
+ def test_fixtures_in_new_session
+ sym = :thirty_seven_signals
+ # fixtures are accessible in main session
+ assert_not_nil companies(sym)
+
+ # create a new session and the fixtures should be accessible in it as well
+ session1 = open_session { |sess| }
+ assert_not_nil session1.companies(sym)
+ end
+end
+
# Tests that integration tests don't call Controller test methods for processing.
# Integration tests have their own setup and teardown.
class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest

0 comments on commit a159fd0

Please sign in to comment.