File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ def open_session(application = nil)
536536 if self . class . respond_to? ( :fixture_table_names )
537537 self . class . fixture_table_names . each do |table_name |
538538 name = table_name . tr ( "." , "_" )
539- next unless respond_to? ( name )
539+ next unless respond_to? ( name , true )
540540 extras . __send__ ( :define_method , name ) { |*args |
541541 delegate . send ( name , *args )
542542 }
Original file line number Diff line number Diff line change @@ -227,6 +227,24 @@ def method_missing(name, *args)
227227 end
228228end
229229
230+ require 'active_record_unit'
231+ # Tests that fixtures are accessible in the integration test sessions
232+ class IntegrationTestWithFixtures < ActiveRecordTestCase
233+ include ActionController ::Integration ::Runner
234+
235+ fixtures :companies
236+
237+ def test_fixtures_in_new_session
238+ sym = :thirty_seven_signals
239+ # fixtures are accessible in main session
240+ assert_not_nil companies ( sym )
241+
242+ # create a new session and the fixtures should be accessible in it as well
243+ session1 = open_session { |sess | }
244+ assert_not_nil session1 . companies ( sym )
245+ end
246+ end
247+
230248# Tests that integration tests don't call Controller test methods for processing.
231249# Integration tests have their own setup and teardown.
232250class IntegrationTestUsesCorrectClass < ActionController ::IntegrationTest
You can’t perform that action at this time.
0 commit comments