Sha256: 3ce597250f82263ceaf286b7020290f75a3f550629fc5e5939116191137f9736
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe FastCache::Memcache::Node, 'initialize' do before :each do @node = FastCache::Memcache::Node.new('localhost', 11211) end it 'should take host and port as arguments' do @node.host.should == 'localhost' @node.port.should == 11211 end it 'should set a default weight of 1' do @node.weight.should == 1 end it 'should set a default status of disconnected' do @node.status.should == :disconnected end end describe FastCache::Memcache::Node, 'connect' do before :each do @conn = FastCache::Memcache::Node.new('localhost', 11211) end describe '(success)' do it 'should set the status to :connected' do TCPSocket.should_receive(:new).with(@conn.host, @conn.port) @conn.connect @conn.status.should == :connected end end describe '(failure)' do it 'should set the status to :dead' do TCPSocket.should_receive(:new).with(@conn.host, @conn.port).and_raise(Errno::ECONNREFUSED) @conn.connect @conn.status.should == :dead end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
binary42-fastcache-0.1 | spec/memcache/node_spec.rb |
binary42-fastcache-0.2 | spec/memcache/node_spec.rb |
binary42-fastcache-0.3 | spec/memcache/node_spec.rb |