1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

we intend to keep the capture helper for Active Record tests.

This is a follow up to f8f5cdc
This commit is contained in:
Yves Senn 2014-07-16 16:15:16 +02:00
parent f8f5cdc98c
commit 2f93aa0d2b

View file

@ -1,9 +1,18 @@
require 'active_support/test_case'
module ActiveRecord
# The +capture+ helper was deprecated because it is not thread safe.
# Our own tests still depend on it.
module UndeprecateCapture
# = Active Record Test Case
#
# Defines some test assertions to test against SQL queries.
class TestCase < ActiveSupport::TestCase #:nodoc:
def teardown
SQLCounter.clear_log
end
def assert_date_from_db(expected, actual, message = nil)
assert_equal expected.to_s, actual.to_s, message
end
def capture(stream)
stream = stream.to_s
captured_stream = Tempfile.new(stream)
@ -20,21 +29,6 @@ module ActiveRecord
captured_stream.unlink
stream_io.reopen(origin_stream)
end
end
# = Active Record Test Case
#
# Defines some test assertions to test against SQL queries.
class TestCase < ActiveSupport::TestCase #:nodoc:
include UndeprecateCapture
def teardown
SQLCounter.clear_log
end
def assert_date_from_db(expected, actual, message = nil)
assert_equal expected.to_s, actual.to_s, message
end
def capture_sql
SQLCounter.clear_log