Sha256: da2783410e2b3af298db399a8554bf51097db423b55d0090b875ead02a5fd816

Contents?: true

Size: 417 Bytes

Versions: 3

Compression:

Stored size: 417 Bytes

Contents

require "stringio"

RSpec.configure do |config|
  # This method is almost copy of wycats's implementation.
  # I found it at http://d.hatena.ne.jp/POCHI_BLACK/comment?date=20100324 .
  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
markup-preview-command-0.0.9 spec/spec_helper.rb
markup-preview-command-0.0.8 spec/spec_helper.rb
markup-preview-command-0.0.7 spec/spec_helper.rb