Class: Dockerspec::EngineList

Inherits:
Object
  • Object
show all
Defined in:
lib/dockerspec/engine_list.rb

Overview

Manages the list of testing engines to use.

Constant Summary collapse

NO_ENGINES_MESSAGE =

A message with description on how to avoid the error when you forget specifying the testing engine you want to use.

"\nRemember to include the Test Engine you want to use.\n\nFor example, to use Serverspec:\n\n    require 'dockerspec/serverspec'\n\n    EOE\n.freeze\n"

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ Dockerspec::EngineList

Constructs the list of engines.

Initializes all the selected engines.

Parameters:

Raises:



58
59
60
61
62
63
# File 'lib/dockerspec/engine_list.rb', line 58

def initialize(runner)
  engine_classes = Configuration.engines
  @engines =
    engine_classes.map { |engine_class| engine_class.new(runner) }
  assert_engines!
end

Instance Method Details

#before_running(*args) ⇒ Object

Setups all the engines one by one.

Parameters:

  • args (Mixed)

    Arguments to pass to the #before_running methods.

Returns:

  • void



74
75
76
# File 'lib/dockerspec/engine_list.rb', line 74

def before_running(*args)
  call_engines_method(:before_running, *args)
end

#restore(*args) ⇒ Object

Restores all the engines one by one.

Parameters:

  • args (Mixed)

    Arguments to pass to the #restore methods.

Returns:

  • void



114
115
116
# File 'lib/dockerspec/engine_list.rb', line 114

def restore(*args)
  call_engines_method(:restore, *args)
end

#when_container_ready(*args) ⇒ Object

Notify the engines that the container to test is selected and ready.

methods.

Parameters:

  • args (Mixed)

    Arguments to pass to the #when_container_ready

Returns:

  • void



88
89
90
# File 'lib/dockerspec/engine_list.rb', line 88

def when_container_ready(*args)
  call_engines_method(:when_container_ready, *args)
end

#when_running(*args) ⇒ Object

Saves all the engines one by one.

Parameters:

  • args (Mixed)

    Arguments to pass to the #when_running methods.

Returns:

  • void



101
102
103
# File 'lib/dockerspec/engine_list.rb', line 101

def when_running(*args)
  call_engines_method(:when_running, *args)
end