diff --git a/spec/integration/simple_spec.rb b/spec/integration/simple_spec.rb index 509fbf9..cfe5968 100644 --- a/spec/integration/simple_spec.rb +++ b/spec/integration/simple_spec.rb @@ -1,19 +1,20 @@ # encoding: utf-8 +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) require 'spec_helper' require 'amqp/server' -require 'spec_server' +require 'server_helper' describe "Simple AMQP connection with FailoverClient" do before(:all) do - @log = SpecServer.log + @log = ServerHelper.log + AMQP.client = AMQP::FailoverClient end it "should be connected" do - AMQP.client = AMQP::FailoverClient EM.run { - @sig = EM.start_server('localhost', 15672, SpecServer) + sig = EM.start_server('localhost', 15672, ServerHelper) conn = AMQP.connect(:host => 'localhost', :port => 15672) EM.add_timer(0.1) { conn.should be_connected diff --git a/spec/spec_server.rb b/spec/server_helper.rb similarity index 91% rename from spec/spec_server.rb rename to spec/server_helper.rb index a83dc2f..80c8ee4 100644 --- a/spec/spec_server.rb +++ b/spec/server_helper.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -module SpecServer +module ServerHelper include AMQP::Server class << self diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 74cfe0f..0301a91 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,18 @@ # encoding: utf-8 # add project-relative load paths -$LOAD_PATH.unshift File.dirname(__FILE__) -$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') +$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) # require stuff require 'rubygems' + begin require 'mq' -rescue Object => e +rescue LoadError => e require 'amqp' end require 'amqp/failover' + require 'rspec' -require 'rspec/autorun' \ No newline at end of file +require 'rspec/autorun' diff --git a/spec/unit/amqp/failover/config_spec.rb b/spec/unit/amqp/failover/config_spec.rb index 0372306..f335e5e 100644 --- a/spec/unit/amqp/failover/config_spec.rb +++ b/spec/unit/amqp/failover/config_spec.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) require 'spec_helper'