Sha256: 04534e3fd008ad0626b34edf649c3ba44d660fbe4e8795acb9be05ef6e048809
Contents?: true
Size: 933 Bytes
Versions: 3
Compression:
Stored size: 933 Bytes
Contents
# encoding: utf-8 require 'rubygems' require 'http_machinegun' require 'webmock/rspec' require 'stringio' require 'simplecov' require 'simplecov-rcov' SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter SimpleCov.start # Set shell to basic $0 = "thor" $thor_runner = true ARGV.clear Thor::Base.shell = Thor::Shell::Basic RSpec.configure do |config| # Captures the output for analysis later # # @example Capture `$stderr` # # output = capture(:stderr) { $stderr.puts "this is captured" } # # @param [Symbol] stream `:stdout` or `:stderr` # @yield The block to capture stdout/stderr for. # @return [String] The contents of $stdout or $stderr 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 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
http_machinegun-0.0.3 | spec/spec_helper.rb |
http_machinegun-0.0.2 | spec/spec_helper.rb |
http_machinegun-0.0.1 | spec/spec_helper.rb |