File: client_spec.rb

package info (click to toggle)
ruby-remcached 0.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 200 kB
  • ctags: 91
  • sloc: ruby: 1,000; sh: 7; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (4)
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