Sha256: 83a3a5873fe2a539cfd5a3948c9c44d1e0aa8c455a0e9f53da19821ff104f004

Contents?: true

Size: 468 Bytes

Versions: 14

Compression:

Stored size: 468 Bytes

Contents

module Plugins; end
  
module Plugins::TestHelper
  # Captures output produced with print.
  def capture_output
    begin
      output = ""
      Kernel.class_eval do
        alias_method :no_print_for_now, :print
        define_method(:print) { |*args| output << args.join }
      end      
      yield
      return output
    ensure
      Kernel.class_eval do
        alias_method :print, :no_print_for_now
        undef no_print_for_now
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
costan-zerg_xcode-0.1 test/plugins/test_helper.rb
costan-zerg_xcode-0.2.1 test/plugins/test_helper.rb
costan-zerg_xcode-0.2 test/plugins/test_helper.rb
costan-zerg_xcode-0.3.1 test/plugins/test_helper.rb
costan-zerg_xcode-0.3.2 test/plugins/test_helper.rb
costan-zerg_xcode-0.3.3 test/plugins/test_helper.rb
costan-zerg_xcode-0.3 test/plugins/test_helper.rb
zerg_xcode-0.3.3 test/plugins/test_helper.rb
zerg_xcode-0.3.1 test/plugins/test_helper.rb
zerg_xcode-0.3 test/plugins/test_helper.rb
zerg_xcode-0.3.2 test/plugins/test_helper.rb
zerg_xcode-0.2.1 test/plugins/test_helper.rb
zerg_xcode-0.2 test/plugins/test_helper.rb
zerg_xcode-0.1 test/plugins/test_helper.rb