Skip to content
This repository
tree: 0c6e3789c6
Fetching contributors…

Cannot retrieve contributors at this time

file 32 lines (29 sloc) 0.703 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
require 'bundler/gem_tasks'
require 'timeout'
require 'socket'

task :default => 'test'

def test_local_tcp_socket(port)
  begin
    timeout(1) do
      socket = TCPSocket.new('localhost', port)
      socket.close
    end
    true
  rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Timeout::Error
    false
  end
end

desc 'Run tests'
task :test do
  puts 'Running tests ...'
  unless test_local_tcp_socket(5672)
    raise('RABBITMQ MUST BE RUNNING!')
  end
  unless test_local_tcp_socket(6379)
    raise('REDIS MUST BE RUNNING!')
  end
  require File.join(File.dirname(__FILE__), 'test', 'helper')
  Dir['test/*_tests.rb'].each do |tests|
    require File.join(File.dirname(__FILE__), tests)
  end
end
Something went wrong with that request. Please try again.