Sha256: 5e6d993497d5a4e130cd4db307b545f4d1b1a91d90dc29bd5ca6593ab2203589

Contents?: true

Size: 483 Bytes

Versions: 5

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

module SpecHelper
  def tmpdir
    TMPDIR
  end

  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new" # rubocop:disable Security/Eval, Style/EvalWithLocation
      yield
      result = eval("$#{stream}").string # rubocop:disable Security/Eval, Style/EvalWithLocation
    ensure
      eval "$#{stream} = #{stream.upcase}" # rubocop:disable Security/Eval, Style/EvalWithLocation
    end

    result
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kitabu-3.1.0 spec/support/helper.rb
kitabu-3.0.3 spec/support/helper.rb
kitabu-3.0.2 spec/support/helper.rb
kitabu-3.0.1 spec/support/helper.rb
kitabu-3.0.0 spec/support/helper.rb