major restructuring, specs probably all break

right now
This commit is contained in:
2011-01-28 17:09:30 +00:00
parent 8d5771a12a
commit 5496445d4d
16 changed files with 418 additions and 284 deletions

View File

@@ -3,13 +3,17 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
require 'spec_helper'
describe AMQP::Failover::Config do
describe 'AMQP::Failover::Config' do
before(:all) do
# @conf = AMQP::Failover::Config.new
end
before(:each) do
@conf = AMQP::Failover::Config.new
[:primary, :configs, :refs].each do |var|
@conf.instance_variable_set("@#{var}", nil)
end
# [:primary, :configs, :refs].each do |var|
# @conf.instance_variable_set("@#{var}", nil)
# end
@raw_configs = [
{:host => 'rabbit3.local'},
{:host => 'rabbit2.local'},
@@ -19,9 +23,9 @@ describe AMQP::Failover::Config do
end
after(:each) do
[:primary, :configs, :refs].each do |var|
@conf.instance_variable_set("@#{var}", nil)
end
# [:primary, :configs, :refs].each do |var|
# @conf.instance_variable_set("@#{var}", nil)
# end
end
it "should set and get configs" do
@@ -31,21 +35,24 @@ describe AMQP::Failover::Config do
@conf.set(@raw_configs[0])
@conf.configs.should have(1).items
@conf.get(0).should == @configs[0]
@conf[0].should == @configs[0]
@conf.set(@raw_configs[1])
@conf.configs.should have(2).items
@conf.get(1).should == @configs[1]
@conf[1].should == @configs[1]
@conf.set(@raw_configs[1], :the_one)
@conf.configs.should have(2).items
@conf.get(1).should == @configs[1]
@conf.get(:the_one).should == @configs[1]
@conf[:the_one].should == @configs[1]
@conf.load_array(@raw_configs)
@conf.configs.should have(3).items
@conf.get_primary.should == @configs[0]
@conf.primary = 1
@conf.get_primary.should == @configs[1]
@conf[:primary].should == @configs[1]
end
it "should #find_next" do

View File

@@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
require 'spec_helper'
require 'server_discovery_helper'
describe AMQP::Failover::ServerDiscovery do
describe 'AMQP::Failover::ServerDiscovery' do
before(:each) do
$called = []