File: memcache_spec.rb

package info (click to toggle)
ruby-em-synchrony 1.0.5-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 572 kB
  • sloc: ruby: 3,458; sh: 37; sql: 7; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (3)
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
require "spec/helper/all"

describe EM::P::Memcache do

  it "should fire sequential memcached requests" do
    EventMachine.synchrony do
      conn = EM::P::Memcache.connect
      key = 'key'
      value = 'value for key'
      fake_key = 'nonexistent key' # without a corresponding value

      conn.delete(key)
      conn.set(key, value)
      conn.get(key).should == value

      conn.delete(key)
      conn.get(key).should be_nil

      conn.set(key, value)
      conn.get(key).should == value

      conn.del(key)
      conn.get(key).should be_nil

      conn.set(key, value)
      conn.get(key, fake_key).should == [value, nil]
      conn.get_hash(key, fake_key).should == { key => value, fake_key => nil }

      EventMachine.stop
    end
  end

end