Sha256: 6f31cd41423cf6df676488c79aae914d627d35a961431225cbced9ec9c235283

Contents?: true

Size: 870 Bytes

Versions: 7

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

require 'rubygems'
require 'rspec'
require 'reckon'

RSpec.configure do |config|
  config.before(:all, &:silence_output)
  config.after(:all,  &:enable_output)
  def fixture_path(file)
    File.expand_path(File.join(File.dirname(__FILE__), "data_fixtures", file))
  end
end

public

# Redirects stderr and stout to /dev/null.txt
def silence_output
  # Store the original stderr and stdout in order to restore them later
  @original_stdout = $stdout
  @original_stderr = $stderr

  # Redirect stderr and stdout
  $stderr = File.new(File.join(File.dirname(__FILE__), 'test_log.txt'), 'w')
  $stdout = $stderr
  Reckon::LOGGER.reopen $stderr
end

# Replace stderr and stdout so anything else is output correctly
def enable_output
  $stdout = @original_stdout
  @original_stdout = nil
  $stderr = @original_stderr
  @original_stderr = nil
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reckon-0.10.0 spec/spec_helper.rb
reckon-0.9.6 spec/spec_helper.rb
reckon-0.9.5 spec/spec_helper.rb
reckon-0.9.4 spec/spec_helper.rb
reckon-0.9.3 spec/spec_helper.rb
reckon-0.9.2 spec/spec_helper.rb
reckon-0.9.1 spec/spec_helper.rb