File: automatic_recovery_predicate_spec.rb

package info (click to toggle)
ruby-amqp 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,508 kB
  • sloc: ruby: 8,272; sh: 11; makefile: 10
file content (68 lines) | stat: -rw-r--r-- 1,262 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
67
68
# encoding: utf-8

require "spec_helper"

describe AMQP::Channel, "#auto_recovery" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec
  include EventedSpec::SpecHelper


  default_options AMQP_OPTS
  default_timeout 2


  it "switches automatic recovery mode on" do
    ch = AMQP::Channel.new(AMQP.connection)
    ch.auto_recovery.should be_false
    ch.auto_recovery = true
    ch.auto_recovery.should be_true
    ch.auto_recovery = false
    ch.auto_recovery.should be_false

    done
  end
end




describe AMQP::Channel, "options hash" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec
  include EventedSpec::SpecHelper


  default_options AMQP_OPTS
  default_timeout 2


  it "can be passed as the 3rd constructor argument" do
    ch = AMQP::Channel.new(AMQP.connection, nil, :auto_recovery => true)
    ch.auto_recovery.should be_true
    ch.auto_recovery = false
    ch.auto_recovery.should be_false

    done
  end


  it "can be passed as the 2nd constructor argument" do
    ch = AMQP::Channel.new(AMQP.connection, :auto_recovery => true)
    ch.auto_recovery.should be_true
    ch.should be_auto_recovering
    ch.auto_recovery = false
    ch.auto_recovery.should be_false
    ch.should_not be_auto_recovering

    done
  end
end