diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index c6a3cdd5db2dbcd718a2c8d5b4037f5ed37915c4..d9de6b8f39693be1e9a2f4f87c877d644f42b9d9 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.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) } diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 609fbb56db6065734a50c264aa530f13ce793c1f..d1bb19c3ee4c35511a99e200029d1b9ce867d8be 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -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