提交 a159fd0b 编写于 作者: A Andrew Kaspick 提交者: Michael Koziarski

Fix fixtures in integration test sessions

Signed-off-by: NMichael Koziarski <michael@koziarski.com>
上级 e8b84ab1
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册