D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
td-agent
/
embedded
/
lib
/
ruby
/
gems
/
2.1.0
/
gems
/
td-0.15.2
/
spec
/
Filename :
spec_helper.rb
back
Copy
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'json' if ENV['SIMPLE_COV'] # SimpleCov # https://github.com/colszowka/simplecov require 'simplecov' SimpleCov.start do add_filter 'spec/' add_filter 'pkg/' add_filter 'vendor/' end end # XXX skip coverage setting if run appveyor. Because, fail to push coveralls in appveyor. unless ENV['APPVEYOR'] require 'coveralls' Coveralls.wear!('rails') end require 'td/command/runner' def execute_td(command_line) args = command_line.split(" ") original_stdin, original_stderr, original_stdout = $stdin, $stderr, $stdout $stdin = captured_stdin = StringIO.new $stderr = captured_stderr = StringIO.new $stdout = captured_stdout = StringIO.new class << captured_stdout def tty? true end end begin runner = TreasureData::Command::Runner.new $0 = 'td' runner.run(args) rescue SystemExit ensure $stdin, $stderr, $stdout = original_stdin, original_stderr, original_stdout end [captured_stderr.string, captured_stdout.string] end class CallSystemExitError < RuntimeError; end shared_context 'quiet_out' do let(:stdout_io) { StringIO.new } let(:stderr_io) { StringIO.new } around do |example| out = $stdout.dup err= $stdout.dup begin $stdout = stdout_io $stderr = stderr_io example.call ensure $stdout = out $stderr = err end end end