Class: Minke::Tasks::Cucumber

Inherits:
Task
  • Object
show all
Defined in:
lib/minke/tasks/cucumber.rb

Instance Method Summary collapse

Methods inherited from Task

#create_container_image, #initialize, #run_command_in_container, #run_with_block

Constructor Details

This class inherits a constructor from Minke::Tasks::Task

Instance Method Details

#get_features(args) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/minke/tasks/cucumber.rb', line 27

def get_features args
  if args != nil && args[:feature] != nil
		feature = "--tags #{args[:feature]}"
	else
		feature = ""
	end
end

#run(args = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/minke/tasks/cucumber.rb', line 5

def run args = nil
	@logger.info "## Running cucumber with tags #{args}"

  compose_file = @config.compose_file_for(@task_name)
  compose_file = File.expand_path(compose_file)
  compose = @docker_compose_factory.create compose_file unless compose_file == nil

  run_with_block do
    status = false
    begin
      compose.up
      server_address = @service_discovery.build_address(@task_settings.health_check) 
      @health_check.wait_for_HTTPOK(server_address) unless @task_settings.health_check == nil
      
      status = @shell_helper.execute "cucumber --color -f pretty #{get_features args}"
    ensure
      compose.down
      @error_helper.fatal_error("Cucumber steps failed") unless status == true
    end
	end
end