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 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
$: << File.dirname(__FILE__) + '/../lib'
require 'remcached'
describe Memcached::Client do
def run(&block)
EM.run do
@cl = Memcached::Client.connect('localhost', &block)
end
end
def stop
@cl.close_connection
EM.stop
end
context "when getting stats" do
before :all do
@stats = {}
run do
@cl.stats do |result|
result[:status].should == Memcached::Errors::NO_ERROR
if result[:key] != ''
@stats[result[:key]] = result[:value]
else
stop
end
end
end
end
it "should have received some keys" do
@stats.should include(*%w(pid uptime time version curr_connections total_connections))
end
end
=begin
it "should keep alive" do
run do
EM::Timer.new(30) do
stop
end
end
end
=end
end
|