spec/spec_helper.rb in amqp-0.7.1 vs spec/spec_helper.rb in amqp-0.7.2

- old
+ new

@@ -4,12 +4,12 @@ require 'bundler' Bundler.setup Bundler.require :default, :test -require "amqp-spec" require "amqp" +require "evented-spec" amqp_config = File.dirname(__FILE__) + '/amqp.yml' if File.exists? amqp_config class Hash @@ -22,11 +22,11 @@ end end end AMQP_OPTS = YAML::load_file(amqp_config).symbolize_keys[:test] else - AMQP_OPTS = {:host => 'localhost', :port => 5672} + AMQP_OPTS = {:host => 'localhost', :port => 5672, :username => "guest", :password => "guest", :vhost => "/"} end # # Ruby version-specific # @@ -76,5 +76,10 @@ def test_method_deliver opts = {} AMQP::Frame::Method.new( AMQP::Protocol::Basic::Deliver.new( :consumer_tag => opts[:consumer_tag] || 'test_consumer')) end + +def delayed(timeout, &block) + instance = self + EM.add_timer(timeout) { instance.instance_eval(&block) } +end # delayed