Sha256: 609cf929caf2decb3d4b4dfe5c6851e266ff195480bf9f278b653a64df138d69

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

ENV['RACK_ENV'] = 'test'

require 'napa/setup'

Napa.skip_initialization = true

require 'napa'

# from https://gist.github.com/adamstegman/926858
RSpec.configure do |config|
  config.before(:all) { silence_output }
  config.after(:all) { enable_output }

  config.before(:each) do
    allow(Napa).to receive(:initialize)
    allow(Napa::Logger).to receive_message_chain('logger.info').with(:napa_deprecation_warning)
  end
end

# Redirects stderr and stdout to /dev/null.
def silence_output
  @orig_stderr = $stderr
  @orig_stdout = $stdout

  # redirect stderr and stdout to /dev/null
  $stderr = File.new('/dev/null', 'w')
  $stdout = File.new('/dev/null', 'w')
end

# Replace stdout and stderr so anything else is output correctly.
def enable_output
  $stderr = @orig_stderr
  $stdout = @orig_stdout
  @orig_stderr = nil
  @orig_stdout = nil
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
napa-0.4.0 spec/spec_helper.rb