Sha256: 76708a6616c23d0f8f0839e0129a31907e2442987160b05d0764fef0f3ffde2a

Contents?: true

Size: 823 Bytes

Versions: 3

Compression:

Stored size: 823 Bytes

Contents

#--
# Copyright (c) 2011 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

3 entries across 3 versions & 1 rubygems

Version Path
engineyard-visualvm-0.5.3-java spec/spec_helper.rb
engineyard-visualvm-0.5.3 spec/spec_helper.rb
engineyard-visualvm-0.5.2 spec/spec_helper.rb