Sha256: a2e085170908913bddec618110d14f41d1d1bd425bc724dea8f526c04a149a66

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

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

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

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


require "effin_utf8"
require "bunny"
require "rabbitmq/http/client"


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



#
# Ruby version-specific
#

case RUBY_VERSION
when "1.8.7" then
  class Array
    alias sample choice
  end
when "1.8.6" then
  raise "Ruby 1.8.6 is not supported. Sorry, pal. Time to move on beyond One True Ruby. Yes, time flies by."
end



module RabbitMQ
  module Control
    def rabbitmq_pid
      $1.to_i if `rabbitmqctl status` =~ /\{pid,(\d+)\}/
    end

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

    def stop_rabbitmq(pid = rabbitmq_pid, delay = 1.0)
      `rabbitmqctl 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

11 entries across 11 versions & 1 rubygems

Version Path
bunny-1.4.1 spec/spec_helper.rb
bunny-1.4.0 spec/spec_helper.rb
bunny-1.3.1 spec/spec_helper.rb
bunny-1.3.0 spec/spec_helper.rb
bunny-1.2.2 spec/spec_helper.rb
bunny-1.2.1 spec/spec_helper.rb
bunny-1.2.0 spec/spec_helper.rb
bunny-1.1.9 spec/spec_helper.rb
bunny-1.1.8 spec/spec_helper.rb
bunny-1.1.7 spec/spec_helper.rb
bunny-1.1.6 spec/spec_helper.rb