Sha256: 87a517375383fdad92b45b11832a696edfa1401fea135ec231dac254c80587b2

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

# -*- encoding: utf-8; mode: ruby -*-

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)

require 'bundler'
Bundler.require(:default, :test)

require "bunny"
require "bunny/test_kit"

puts "Using Ruby #{RUBY_VERSION}, amq-protocol #{AMQ::Protocol::VERSION}"

module RabbitMQ
  module Control

    RABBITMQ_NODENAME = ENV['RABBITMQ_NODENAME'] || 'rabbit'

    def rabbitmq_pid
      $1.to_i if `rabbitmqctl -n #{RABBITMQ_NODENAME} status` =~ /\{pid,(\d+)\}/
    end

    def start_rabbitmq(delay = 1.0)
      # this is Homebrew-specific :(
      `RABBITMQ_NODENAME=#{RABBITMQ_NODENAME} rabbitmq-server > /dev/null 2>&1 &`; sleep(delay)
    end

    def stop_rabbitmq(pid = rabbitmq_pid, delay = 1.0)
      `rabbitmqctl -n #{RABBITMQ_NODENAME} stop`; sleep(delay)
    end

    def kill_rabbitmq(pid = rabbitmq_pid, delay = 1.0)
      # tango is down, tango is down!
      Process.kill("KILL", pid); sleep(delay)
    end
  end
end


module PlatformDetection
  def mri?
    !defined?(RUBY_ENGINE) || (defined?(RUBY_ENGINE) && ("ruby" == RUBY_ENGINE))
  end

  def rubinius?
    defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'rbx')
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bunny-2.19.0 spec/spec_helper.rb
bunny-2.18.0 spec/spec_helper.rb
bunny-2.17.0 spec/spec_helper.rb
bunny-2.16.1 spec/spec_helper.rb
bunny-2.15.0 spec/spec_helper.rb
bunny-2.14.4 spec/spec_helper.rb
bunny-2.14.3 spec/spec_helper.rb
bunny-2.14.2 spec/spec_helper.rb
bunny-2.14.1 spec/spec_helper.rb