Sha256: a8bfdeebd38879d294f03ad5ea4200d77c793c51366599ba309c945abeb12b7e

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

$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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
td-0.12.0 spec/spec_helper.rb
td-0.11.14 spec/spec_helper.rb