Sha256: d42a0e932d15bb2fe21f9333775abd845c7e9da5a322ec5263cc0ae975e4af42

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'rake'
require 'cucumber/rake/task'
 
module Henry
  
  class Task
    
    # The Henry Task implementation for Cucumber
    class CucumberTask < Task
 
      # Makes available the cucumber rake task.
      Cucumber::Rake::Task.new do |t|
        t.cucumber_opts = %w{--out cucumber.out}
      end
      
      # Executes the CucumberTask and returns its results.
      #
      # @return [Hash] the CucumberTask results.
      def execute(params)
        begin
          File.open('cucumber.out', 'w') { |f| }

          tail_thread = Thread.new { system('tail -f cucumber.out') }

          Rake.application['cucumber'].invoke 
 
          tail_thread.kill

          {
            code:0,
            message:"OK",
            data:File.open('cucumber.out', 'r').read,
            stacktrace:nil
          }
        rescue Exception => e
          {
            code:2,
            message:e.message,
            data:File.open('cucumber.out', 'r').read,
            stacktrace:e.backtrace
          }
        end
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
henry-container-0.0.1 lib/henry/task/cucumber_task.rb