Class: MSpecTestRunner

Inherits:
Object
  • Object
show all
Includes:
Albacore::RunCommand, Albacore::Task
Defined in:
lib/albacore/mspectestrunner.rb

Constant Summary collapse

TaskName =
:mspec

Instance Attribute Summary collapse

Attributes included from Albacore::RunCommand

#command, #working_directory

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from Albacore::RunCommand

#get_command, #run_command

Methods included from AttrMethods

#attr_array, #attr_hash

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

Methods included from YAMLConfig

#configure, #load_config_by_task_name

Methods included from Logging

#create_logger, #log_device=, #log_level, #log_level=

Methods included from Failure

#fail_with_message

Constructor Details

#initialize(command = nil) ⇒ MSpecTestRunner

Returns a new instance of MSpecTestRunner.



11
12
13
14
15
16
# File 'lib/albacore/mspectestrunner.rb', line 11

def initialize(command=nil)
  @assemblies=[]
  super()
  update_attributes Albacore.configuration.mspec.to_hash
  @command = command unless command.nil?
end

Instance Attribute Details

#html_outputObject

Returns the value of attribute html_output.



8
9
10
# File 'lib/albacore/mspectestrunner.rb', line 8

def html_output
  @html_output
end

Instance Method Details

#build_assembly_listObject



43
44
45
# File 'lib/albacore/mspectestrunner.rb', line 43

def build_assembly_list
  @assemblies.map{|asm| "\"#{asm}\""}.join(" ") 
end

#build_html_outputObject



47
48
49
# File 'lib/albacore/mspectestrunner.rb', line 47

def build_html_output
  "--html \"#{@html_output}\""
end

#executeObject



35
36
37
38
39
40
41
# File 'lib/albacore/mspectestrunner.rb', line 35

def execute()
  command_params = get_command_parameters
  result = run_command "MSpec", command_params.join(" ")
  
  failure_message = 'MSpec Failed. See Build Log For Detail'
  fail_with_message failure_message if !result
end

#get_command_lineObject



18
19
20
21
22
23
24
25
# File 'lib/albacore/mspectestrunner.rb', line 18

def get_command_line
  command = []
  command << @command
  command << get_command_parameters
  cmd = command.join(" ")
  @logger.debug "Build MSpec Test Runner Command Line: " + cmd
  return cmd
end

#get_command_parametersObject



27
28
29
30
31
32
33
# File 'lib/albacore/mspectestrunner.rb', line 27

def get_command_parameters
  command_params = []
  command_params << build_assembly_list unless @assemblies.empty?
  command_params << @options.join(" ") unless @options.nil?
  command_params << build_html_output unless @html_output.nil?
  command_params
end