Sha256: aa71689bc8d451bc8b04a8abba188aeefdb5fbdf7a83c1d4923a945badeb6d0e

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

GEM_ROOT = File.expand_path(File.join(File.dirname(__FILE__),'..'))

ENV['RAILS_ENV']  ||= 'test'

require 'simplecov'
require 'pry-byebug'

SimpleCov.start do
  add_filter "/spec/"
end

require 'pwwka'
require 'pwwka/test_handler'
begin
  require 'active_support/core_ext/hash'
rescue NameError
  require "active_support/isolated_execution_state"
  require 'active_support/core_ext/hash'
end

# These are required in pwwka proper, but they are guarded to not cause
# an error if missing.  Requiring here so their absence will fail the tests
require 'resque'
require 'resque-retry'
require 'sidekiq'

require 'support/test_configuration'

test_configuration = TestConfiguration.new(File.join(GEM_ROOT,"docker-compose.yml"))

RSpec.configure do |config|

  config.expect_with :rspec do |c|
    c.syntax = [:should,:expect] # should is needed to make a resque helper
                                 # from resqutils work
  end

  config.before(:suite) do
    Pwwka.configure do |c|
      c.topic_exchange_name        = "topics-test"
      c.options[:allow_delayed]    = true
      c.requeue_on_error           = false
      c.rabbit_mq_host             = "amqp://guest:guest@localhost:#{test_configuration.rabbit_port}"
      c.app_id                     = "MyAwesomeApp"
      c.process_name               = "my_awesome_process"

      unless ENV["SHOW_PWWKA_LOG"] == "true"
        c.logger = MonoLogger.new("/dev/null")
      end
    end
    Resque.redis = Redis.new(port: test_configuration.resque_redis_port)
  end
  config.around(:each) do |example|
    if example.metadata[:integration]
      result = test_configuration.check_services
      unless result.up?
        fail result.error
      end
    end
    example.run
    Pwwka.configuration.receive_raw_payload = false
  end
  config.order = :random
  config.filter_run_excluding :legacy
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pwwka-1.0.0 spec/spec_helper.rb
pwwka-1.0.0.RC1 spec/spec_helper.rb