Class: CucumberVoIP::RayoDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber-voip/rayo_driver.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRayoDriver

Returns a new instance of RayoDriver.



33
34
35
36
37
38
39
40
41
# File 'lib/cucumber-voip/rayo_driver.rb', line 33

def initialize
  @options = {
                :jid            => '[email protected]',
                :password       => '1',
                :host           => '127.0.0.1',
                :queue_timeout  => 30,
                :write_timeout  => 30
              }
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



11
12
13
# File 'lib/cucumber-voip/rayo_driver.rb', line 11

def options
  @options
end

Class Method Details

.method_missing(method_name, *args, &block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/cucumber-voip/rayo_driver.rb', line 20

def method_missing(method_name, *args, &block)
  if tester_instance.respond_to? method_name
    tester_instance.send method_name, *args, &block
  else
    super
  end
end

.respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/cucumber-voip/rayo_driver.rb', line 28

def respond_to?(method_name)
  super || tester_instance.respond_to?(method_name)
end

.tester_instanceObject



16
17
18
# File 'lib/cucumber-voip/rayo_driver.rb', line 16

def tester_instance
  @@tester_instance ||= new
end

Instance Method Details

#startObject

Raises:

  • (StandardError)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cucumber-voip/rayo_driver.rb', line 47

def start
  raise StandardError, 'You cannot start the Rayo driver more than once!' if @rayo
  @rayo = RSpecRayo::RayoDriver.new :username       => options[:jid],
                                    :password       => options[:password],
                                    :host           => options[:host],
                                    :port           => options[:port],
                                    :queue_timeout  => options[:queue_timeout],
                                    :write_timeout  => options[:write_timeout]
  begin
    @rayo.wait_for_connection 10
  rescue Timeout::Error
    abort 'Could not connect to Rayo Server. Aborting!'
  end
end