Class: RSpecRayo::Tropo1Driver
- Inherits:
-
Object
- Object
- RSpecRayo::Tropo1Driver
- Defined in:
- lib/rspec-rayo/tropo1/driver.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#drb ⇒ Object
Returns the value of attribute drb.
-
#result ⇒ Object
Returns the value of attribute result.
-
#script_content ⇒ Object
Returns the value of attribute script_content.
Instance Method Summary collapse
- #add_latch(latch_name, count = 1) ⇒ Object
-
#initialize(uri = nil, latch_timeout = 5) ⇒ Tropo1Driver
constructor
A new instance of Tropo1Driver.
- #place_call(session_url) ⇒ Object
- #reset! ⇒ Object
- #start_drb ⇒ Object
- #stop_drb ⇒ Object
- #trigger(latch_name) ⇒ Object
- #wait(latch_name) ⇒ Object
Constructor Details
#initialize(uri = nil, latch_timeout = 5) ⇒ Tropo1Driver
Returns a new instance of Tropo1Driver.
10 11 12 13 14 15 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 10 def initialize(uri = nil, latch_timeout = 5) @uri = uri || "druby://0.0.0.0:8787" @latch_timeout = latch_timeout @config = {} reset! end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 8 def config @config end |
#drb ⇒ Object
Returns the value of attribute drb.
8 9 10 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 8 def drb @drb end |
#result ⇒ Object
Returns the value of attribute result.
8 9 10 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 8 def result @result end |
#script_content ⇒ Object
Returns the value of attribute script_content.
8 9 10 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 8 def script_content @script_content end |
Instance Method Details
#add_latch(latch_name, count = 1) ⇒ Object
37 38 39 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 37 def add_latch(latch_name, count = 1) @latches[latch_name] = CountDownLatch.new count end |
#place_call(session_url) ⇒ Object
47 48 49 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 47 def place_call(session_url) Net::HTTP.get URI.parse(session_url) end |
#reset! ⇒ Object
25 26 27 28 29 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 25 def reset! @script_content = nil @result = nil @latches = {} end |
#start_drb ⇒ Object
17 18 19 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 17 def start_drb @drb = DRb.start_service @uri, self end |
#stop_drb ⇒ Object
21 22 23 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 21 def stop_drb @drb.stop_service end |
#trigger(latch_name) ⇒ Object
31 32 33 34 35 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 31 def trigger(latch_name) latch = @latches[latch_name] raise RuntimeError, "No latch by that name" unless latch latch.countdown! end |
#wait(latch_name) ⇒ Object
41 42 43 44 45 |
# File 'lib/rspec-rayo/tropo1/driver.rb', line 41 def wait(latch_name) latch = @latches[latch_name] raise RuntimeError, "No latch by that name" unless latch latch.wait @latch_timeout end |