Sha256: 19ea4d0098fc6abf2d659c325d29af3ce74d456f2bf60a9912d0bc1684839452

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

#--
# Copyright (c) 2011-2012 Engine Yard, Inc.
# See the file LICENSE.txt included with the distribution for
# software license details.
#++

require 'rspec'
require 'engineyard-visualvm'

module EYVisualVMSpecHelpers
  def silence(io = nil)
    require 'stringio'
    io = StringIO.new
    old_stdout = $stdout
    old_stderr = $stderr
    $stdout = io
    $stderr = io
    yield
    io.string
  ensure
    $stdout = old_stdout
    $stderr = old_stderr
  end

  alias capture silence
end

module SystemDouble
  def self.included(base)
    def base.system_double
        @@double
    end
    def base.system_double=(d)
      @@double = d
    end
  end

  def system_double
    @@double
  end

  def system(*args)
    system_double.system(*args)
  end
end

RSpec.configure do |config|
  config.include EYVisualVMSpecHelpers
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
engineyard-visualvm-0.5.4-java spec/spec_helper.rb
engineyard-visualvm-0.5.4 spec/spec_helper.rb