Class: Validator::Testee
- Inherits:
-
Object
- Object
- Validator::Testee
- Includes:
- RSpec::Matchers
- Defined in:
- spec/support/testee.rb
Direct Known Subclasses
Constant Summary collapse
- @@sentinel_errors =
[]
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
-
#connected(options = {}) {|Async::Task.current, @node, @proxy| ... } ⇒ Object
Ensures that the site is connected.
-
#disconnected {|Async::Task.current| ... } ⇒ Object
Disconnects the site if connected before calling the block with a single argument ‘task`, which is an an Async::Task.
-
#isolated(options = {}) {|Async::Task.current, @node, @proxy| ... } ⇒ Object
Like ‘connected`, except that the connection is is closed after the test, before the next test is run.
-
#reconnected(options = {}) {|Async::Task.current, @node, @proxy| ... } ⇒ Object
Disconnects the site if connected, then waits until the site is connected before calling the block.
-
#stop(why = nil) ⇒ Object
Stop the rsmp supervisor.
Class Method Details
.sentinel_errors ⇒ Object
14 15 16 |
# File 'spec/support/testee.rb', line 14 def self.sentinel_errors @@sentinel_errors end |
Instance Method Details
#connected(options = {}) {|Async::Task.current, @node, @proxy| ... } ⇒ Object
Ensures that the site is connected. If the site is already connected, the block will be called immediately. Otherwise waits until the site is connected before calling the block. Use this unless there’s a specific reason to use one of the other methods. A sequence of test using ‘connected` will maintain the current connection to the site without disconnecting/reconnecting, leading to faster testing.
28 29 30 31 32 |
# File 'spec/support/testee.rb', line 28 def connected ={}, &block start , 'Connecting' wait_for_proxy yield Async::Task.current, @node, @proxy end |
#disconnected {|Async::Task.current| ... } ⇒ Object
Disconnects the site if connected before calling the block with a single argument ‘task`, which is an an Async::Task.
63 64 65 66 |
# File 'spec/support/testee.rb', line 63 def disconnected &block stop 'Disconnecting' yield Async::Task.current end |
#isolated(options = {}) {|Async::Task.current, @node, @proxy| ... } ⇒ Object
Like ‘connected`, except that the connection is is closed after the test, before the next test is run. Use this if you somehow modify the RSMP::SiteProxy or otherwise make the current connection unstable or unusable. Because `isolated` closes the connection after the test, you ensure that the modified RSMP::SiteProxy object is discarted and following tests use a new object.
53 54 55 56 57 58 59 |
# File 'spec/support/testee.rb', line 53 def isolated ={}, &block stop 'Isolating' start , 'Connecting' wait_for_proxy yield Async::Task.current, @node, @proxy stop 'Isolating' end |
#reconnected(options = {}) {|Async::Task.current, @node, @proxy| ... } ⇒ Object
Disconnects the site if connected, then waits until the site is connected before calling the block. Use this if your test specifically needs to start with a fresh connection. But be aware that a fresh connection does not guarantee that the equipment will be in a pristine state. The equipment is not restarted or otherwise reset.
40 41 42 43 44 45 |
# File 'spec/support/testee.rb', line 40 def reconnected ={}, &block stop 'Reconnecting' start wait_for_proxy yield Async::Task.current, @node, @proxy end |