Sha256: 7e0f195332a77ecc34a6138821dbc7b716bf1d11f6fdf853101ef1dc3c4487d5

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

ENV['RACK_ENV'] = 'test'

require 'service_template/setup'
require 'acts_as_fu'

require "codeclimate-test-reporter"
CodeClimate::TestReporter.start

ServiceTemplate.skip_initialization = true

require 'service_template'
require 'service_template/rspec_extensions/response_helpers'

# from https://gist.github.com/adamstegman/926858
RSpec.configure do |config|
  config.include ServiceTemplate::RspecExtensions::ResponseHelpers

  config.before(:all) { silence_output }
  config.after(:all) { enable_output }

  config.include ActsAsFu

  config.before(:each) do
    allow(ServiceTemplate).to receive(:initialize)
    allow(ServiceTemplate::Logger).to receive_message_chain('logger.info').with(:service_template_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

3 entries across 3 versions & 1 rubygems

Version Path
service_template-0.5.2 spec/spec_helper.rb
service_template-0.5.1 spec/spec_helper.rb
service_template-0.5.0 spec/spec_helper.rb