class Minke::Tasks::Cucumber

Public Instance Methods

get_features(args) click to toggle source
# File lib/minke/tasks/cucumber.rb, line 30
def get_features args
  if args != nil && args[:feature] != nil
          feature = "--tags #{args[:feature]}"
  else
          feature = ""
  end
end
run(args = nil) click to toggle source
# 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 |pre_func, post_func|
    status = false
    begin
      compose.up
      pre_func.call

      server_address = @service_discovery.build_address(@task_settings.health_check) 
      @health_check.wait_for_HTTPOK(server_address) unless @task_settings.health_check == nil
      @shell_helper.execute "cucumber --color -f pretty #{get_features args}"
    rescue Exception => e
      raise ("Cucumber steps failed: #{e.message}") unless status == true
    ensure
      compose.down
      post_func.call
    end
  end
end