Sha256: cda8bf4915ffb79aca7bf23a618e985c328c585b24cb6d221f4d7c4beae27948

Contents?: true

Size: 1.67 KB

Versions: 8

Compression:

Stored size: 1.67 KB

Contents

module Context
  module DeployHelpers
    module CucumberHelper
      def cucumber_configuration(context, commands)
        context.existing_cucumber_configuration = Cucumber::Cli::Main.new(commands.dup).configuration unless context.existing_cucumber_configuration
        context.existing_cucumber_configuration
      end

      def cucumber_runtime(context, commands)
        return Cucumber::Runtime.new(context.cucumber_configuration(context, commands)) unless context.existing_cucumber_runtime

        context.existing_cucumber_runtime.configure(context.cucumber_configuration(context, commands))
        context.existing_cucumber_runtime
      end

      def cucumber(context, commands = [])
        begin
          require 'cucumber'
          context.existing_cucumber_runtime = context.cucumber_runtime(context, commands)
          context.cucumber_runtime(context, commands).run!
        rescue Exception => e
          context.warning_log "Cucumber library not available", "Unable to use internal cucumber, using external application instead for command #{commands}"
          context.execute_command(%w(chef exec cucumber) + commands)
        end
        # context.bundle_exec(context,['cucumber'] + commands)
      end

      def cucumber_test(context)
        context.git_build(context)
        context.debug_log "Working in folder #{Dir.pwd}\nAnd context #{context.context_name} is created in folder #{context.context_folder} at version #{context.version}"
        context.cucumber(context)
      end

      def cucumber_test_successful?(context)
        result = cucumber_test(context)
        context.debug_log "\n\nCucumber test result: #{result}"
        result
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
deploy-context-2.13.7.1.g02c67e1 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.7 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.6 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.5.1.gb802412 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.5 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.4 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.3 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb
deploy-context-2.13.2.18.g9a85249 /home/jimboadmin/deploy-context/libraries/deploy-context/helpers/../../../libraries/deploy-context/deploy/cucumber.rb