Sha256: e275f5517dde16519f14a8d7fc63e4ceaf092591a76d6bc6100fbf14c7f6e5c5

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

require 'rake'
require 'rspec/core/rake_task'
 
module Henry
  
  class Task
    
    # The Henry Task implementation for Rspec
    class RspecTask < Task
 
      # Makes available the spec rake task.
      RSpec::Core::RakeTask.new do |t|
        t.rspec_opts = '--out rspec.out --format documentation --color'
      end
      
      # Executes the CucumberTask and returns its results.
      #
      # @return [Hash] the CucumberTask results.
      def execute(params)
        begin
          File.open('rspec.out', 'w') { |f| }

          tail_pid = Process.spawn('tail -f rspec.out')

          Rake.application['spec'].invoke 
 
          Process.kill(:SIGINT, tail_pid)

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

    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
henry-container-0.0.15 lib/henry/task/rspec_task.rb
henry-container-0.0.14 lib/henry/task/rspec_task.rb
henry-container-0.0.13 lib/henry/task/rspec_task.rb
henry-container-0.0.12 lib/henry/task/rspec_task.rb
henry-container-0.0.11 lib/henry/task/rspec_task.rb
henry-container-0.0.10 lib/henry/task/rspec_task.rb
henry-container-0.0.9 lib/henry/task/rspec_task.rb
henry-container-0.0.8 lib/henry/task/rspec_task.rb