From 158af72857dbadd5e719cd5852c90a98a3474404 Mon Sep 17 00:00:00 2001 From: Andrew Kaspick Date: Wed, 4 Aug 2010 14:36:16 -0500 Subject: [PATCH] Fix fixtures in integration test sessions --- actionpack/lib/action_controller/integration.rb | 2 +- actionpack/test/controller/integration_test.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 1447f01..a6ecb8e 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -535,7 +535,7 @@ EOF 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 609fbb5..d1bb19c 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -227,6 +227,24 @@ class IntegrationTestTest < Test::Unit::TestCase 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 -- 1.6.0.4