diff options
author | Krekoten' Marjan <krekoten@gmail.com> | 2010-09-16 19:03:55 +0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-18 20:49:36 +0200 |
commit | d4fa120671e989eecb71c14647dd2051d28de4a5 (patch) | |
tree | e5b9e768a4661dbac8c5f895b85d240be094aa4f /railties | |
parent | 76266a818449c732440e7e2ef4de8442ac6af891 (diff) | |
download | rails-d4fa120671e989eecb71c14647dd2051d28de4a5.tar.gz rails-d4fa120671e989eecb71c14647dd2051d28de4a5.tar.bz2 rails-d4fa120671e989eecb71c14647dd2051d28de4a5.zip |
Move capture to Kernel. [#5641 state:resolved]
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/test_case.rb | 20 | ||||
-rw-r--r-- | railties/test/railties/engine_test.rb | 14 |
2 files changed, 2 insertions, 32 deletions
diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb index 3376b422cb..cab8708be3 100644 --- a/railties/lib/rails/generators/test_case.rb +++ b/railties/lib/rails/generators/test_case.rb @@ -1,6 +1,7 @@ require 'active_support/core_ext/class/attribute' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/hash/reverse_merge' +require 'active_support/core_ext/kernel/reporting' require 'rails/generators' require 'fileutils' @@ -65,25 +66,6 @@ module Rails self.destination_root = path end - # Captures the given stream and returns it: - # - # stream = capture(:stdout){ puts "Cool" } - # stream # => "Cool\n" - # - def capture(stream) - begin - stream = stream.to_s - eval "$#{stream} = StringIO.new" - yield - result = eval("$#{stream}").string - ensure - eval("$#{stream} = #{stream.upcase}") - end - - result - end - alias :silence :capture - # Asserts a given file exists. You need to supply an absolute path or a path relative # to the configured destination: # diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 6b90b32005..92d6fc74dc 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -1,22 +1,10 @@ require "isolation/abstract_unit" require "railties/shared_tests" require 'stringio' +require 'active_support/core_ext/kernel/reporting' module RailtiesTest class EngineTest < Test::Unit::TestCase - # TODO: it's copied from generators/test_case, maybe make a module with such helpers? - def capture(stream) - begin - stream = stream.to_s - eval "$#{stream} = StringIO.new" - yield - result = eval("$#{stream}").string - ensure - eval("$#{stream} = #{stream.upcase}") - end - - result - end include ActiveSupport::Testing::Isolation include SharedTests |