Class: Dockerspec::Engine::Specinfra
- Defined in:
- lib/dockerspec/engine/specinfra.rb,
lib/dockerspec/engine/specinfra/backend.rb
Overview
The Specinfra (Serverspec) testing engine implementation.
Defined Under Namespace
Classes: Backend
Instance Method Summary collapse
-
#before_running ⇒ Object
private
Sets the Specinfra configuration.
-
#initialize(runner) ⇒ Dockerspec::Engine::Specinfra
constructor
Constructs a testing engine to use Specinfra (used by Serverspec).
-
#restore ⇒ Object
private
Restores the Specinfra backend instance to point to this object's container.
-
#when_running ⇒ Object
private
Saves the Specinfra backend reference internally to restore it later.
Methods inherited from Base
Constructor Details
#initialize(runner) ⇒ Dockerspec::Engine::Specinfra
Constructs a testing engine to use Specinfra (used by Serverspec).
39 40 41 42 |
# File 'lib/dockerspec/engine/specinfra.rb', line 39 def initialize(runner) super @backend = nil end |
Instance Method Details
#before_running ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets the Specinfra configuration.
- Resets the internal Specinfra backend reference.
- Sets the chosen container name with Docker Compose.
- Sets the
:family
.
55 56 57 58 59 60 61 62 |
# File 'lib/dockerspec/engine/specinfra.rb', line 55 def before_running if @backend.nil? @backend = Backend.new(backend_name) @backend.reset end setup_container_name setup_family end |
#restore ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Restores the Specinfra backend instance to point to this object's container.
This is used to avoid Serverspec running against the previous started container if you are testing multiple containers at the same time.
86 87 88 89 90 |
# File 'lib/dockerspec/engine/specinfra.rb', line 86 def restore @backend.restore setup_container_name setup_family end |
#when_running ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Saves the Specinfra backend reference internally to restore it later.
71 72 73 |
# File 'lib/dockerspec/engine/specinfra.rb', line 71 def when_running @backend.save end |