Sha256: 0a54325d4cf21272c067d6a1f43f8fb0abe80748157e6ae0fde63f6e917d4237
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'rspec/wait' require 'dotenv' require 'aws-sdk' require 'simplecov' Dotenv.load SimpleCov.start require 'sqewer' RSpec.configure do |config| config.order = 'random' config.around :each do | example | if example.metadata[:sqs] queue_name = 'sqewer-test-queue-%s' % SecureRandom.hex(6) client = Aws::SQS::Client.new resp = client.create_queue(queue_name: queue_name) ENV['SQS_QUEUE_URL'] = resp.queue_url example.run # Sometimes the queue is already deleted before the example completes. If the test has passed, # we do not really care whether this invocation raises an exception about a non-existent queue since # all we care about is the queue _being gone_ at the end of the example. client.delete_queue(queue_url: ENV.fetch('SQS_QUEUE_URL')) rescue Aws::SQS::Errors::NonExistentQueue ENV.delete('SQS_QUEUE_URL') else example.run end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sqewer-5.0.3 | spec/spec_helper.rb |
sqewer-5.0.2 | spec/spec_helper.rb |
sqewer-5.0.1 | spec/spec_helper.rb |