require 'rake' require 'rspec/core/rake_task' module Henry class Task # The Henry Task implementation for Rspec class RspecTask < Task # Executes the Task and returns its results. def execute begin Rake.application['spec'].invoke self.execution.code = 'OK' self.execution.message = 'OK' self.execution.output = File.open('rspec.out', 'r').read rescue Exception => e self.execution.code = 'ERROR' self.execution.message = 'ERROR' self.execution.output = File.open('rspec.out', 'r').read self.execution.backtrace = e.message end end # Configures the Task. # # @param [Hash] params the task params. def configure(params) File.open('rspec.out', 'w') { |f| } # Makes available the spec rake task. RSpec::Core::RakeTask.new do |t| t.pattern = (self.data.options && self.data.options['pattern']) || 'spec/*' t.rspec_opts = '--out rspec.out' end self.export_params(params) end end end end