File: hiredis_spec.rb

package info (click to toggle)
ruby-em-synchrony 1.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 556 kB
  • ctags: 304
  • sloc: ruby: 3,508; sh: 37; sql: 7; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,324 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require "spec/helper/all"

describe EM::Hiredis do

  xit "should connect on demand" do
    EventMachine.synchrony do
      connection = EM::Hiredis::Client.connect
      connection.should_not be_connected

      connection.ping
      connection.should be_connected

      EventMachine.stop
    end
  end

  xit "should work with compact connect syntax" do
    EventMachine.synchrony do
      redis = EM::Hiredis.connect

      redis.set('a', 'bar')
      redis.get('a').should == 'bar'

      EM.stop
    end
  end

  xit "should work with manual db select" do
    EventMachine.synchrony do
      redis = EM::Hiredis.connect 'redis://127.0.0.1:6379'
      redis.select(0)

      redis.set('a', 'baz')
      redis.get('a').should == 'baz'

      EM.stop
    end
  end

  xit "should get/set records synchronously" do
    EventMachine.synchrony do
      redis = EM::Hiredis::Client.connect

      redis.set('a', 'foo')
      redis.get('a').should == 'foo'
      redis.get('c').should == nil

      EM.stop
    end
  end

  xit "should incr/decr key synchronously" do
    EventMachine.synchrony do
      redis = EM::Hiredis::Client.connect
      redis.del('key')

      redis.incr('key')
      redis.get('key').to_i.should == 1

      redis.decr('key')
      redis.get('key').to_i.should == 0

      EM.stop
    end
  end
end