Sha256: 30aa9af130bb71453c751b45793cc026355dc6b4f8c618671283f4db79614e32

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

if RUBY_VERSION =~ /^(1\.9|2)/
  require 'coveralls'
  Coveralls.wear!
end

require 'rspec'

ROOT = Pathname.new(__FILE__).dirname.join('..')
require ROOT.join('lib', 'rabbithole')
require 'net/http'

Dir[ROOT.join("spec/support/**/*.rb")].each {|f| require f}

RABBITCTL_COMMAND = ENV['TRAVIS'] ? 'sudo rabbitmqctl' : 'rabbitmqctl'

Thread.abort_on_exception = true

RSpec.configure do |config|
  config.mock_with :rspec

  config.before :suite do
    # Create test vhost
    %x{
      #{RABBITCTL_COMMAND} add_vhost #{Rabbithole::Connection::Settings.vhost}
      #{RABBITCTL_COMMAND} add_user #{Rabbithole::Connection::Settings.user} #{Rabbithole::Connection::Settings.password}
      #{RABBITCTL_COMMAND} set_permissions -p #{Rabbithole::Connection::Settings.vhost} #{Rabbithole::Connection::Settings.user} ".*" ".*" ".*"
    }
    unless ENV['TRAVIS']
      %x{#{RABBITCTL_COMMAND} set_permissions -p #{Rabbithole::Connection::Settings.vhost} guest ".*" ".*" ".*"}
    end
  end

  config.after :suite do
    %x{
      #{RABBITCTL_COMMAND} delete_vhost #{Rabbithole::Connection::Settings.vhost}
      #{RABBITCTL_COMMAND} delete_user #{Rabbithole::Connection::Settings.user}
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rabbithole-0.0.3 spec/spec_helper.rb
rabbithole-0.0.2 spec/spec_helper.rb