Class: Dockerspec::Serverspec::SpecinfraBackend
- Inherits:
-
Object
- Object
- Dockerspec::Serverspec::SpecinfraBackend
- Defined in:
- lib/dockerspec/serverspec/specinfra_backend.rb
Overview
A class to handle the underlying Specinfra backend.
This class saves Specinfra instance in internally and then it is able to recover it from there and setup the running environment accordingly.
This class uses a small hack in the Specinfra class to reset its internal singleton instance.
Instance Method Summary collapse
-
#initialize(backend) ⇒ SpecinfraBackend
constructor
The SpecinfraBackend constructor.
-
#reset ⇒ Object
Resets the Specinfra backend.
-
#restore ⇒ Object
Restores the Specinfra backend instance.
-
#save ⇒ Object
Saves the Specinfra backend instance reference internally.
Constructor Details
#initialize(backend) ⇒ SpecinfraBackend
The SpecinfraBackend constructor.
44 45 46 |
# File 'lib/dockerspec/serverspec/specinfra_backend.rb', line 44 def initialize(backend) @backend = backend end |
Instance Method Details
#reset ⇒ Object
Resets the Specinfra backend.
77 78 79 |
# File 'lib/dockerspec/serverspec/specinfra_backend.rb', line 77 def reset instance_set(nil) end |
#restore ⇒ Object
Restores the Specinfra backend instance.
66 67 68 |
# File 'lib/dockerspec/serverspec/specinfra_backend.rb', line 66 def restore instance_set(@saved_backend_instance) end |
#save ⇒ Object
Saves the Specinfra backend instance reference internally.
55 56 57 |
# File 'lib/dockerspec/serverspec/specinfra_backend.rb', line 55 def save @saved_backend_instance = backend_instance end |