class Object

Public Instance Methods

feature_dir(dir, &block) click to toggle source
# File lib/cucumber-chef/rake/task.rb, line 10
def feature_dir(dir, &block)
  puts("=" * 80)
  puts("feature_dir(#{dir.inspect})")
  puts("=" * 80)

  system(%(echo "<li /><p>#{File.basename(dir)}<ul>" | tee -a #{@index_html}))
  block.call
  system(%(echo "</p></ul>" | tee -a #{@index_html}))
end
run_feature(feature_file) click to toggle source
# File lib/cucumber-chef/rake/task.rb, line 20
def run_feature(feature_file)
  puts("=" * 80)
  puts("run_feature(#{feature_file.inspect})")
  puts("=" * 80)

  filename = feature_file.gsub(/(\w*).feature/, '\1.html')
  puts("#{feature_file} -> public/#{filename}")

  system(%(mkdir -pv #{File.dirname("public/#{filename}")}))

  push = (@pushed ? nil : %(PUSH="YES"))
  output_file = File.join(@output_dir, filename)
  command = [push, "bundle exec cucumber", "features/support", feature_file, ENV['EXTRA_CUCUMBER_ARGS'], "--format html", "--out", output_file].flatten.compact.join(" ")
  @pushed = true if !@pushed
  puts("command=#{command.inspect}")
  system(command)
  @exit_codes << $?.exitstatus

  passed = "<font style='font-weight: bold; color: green;'>PASSED</font>"
  failed = "<font style='font-weight: bold; color: red;'>FAILED</font>"
  status = ((@exit_codes[-1] == 0) ? passed : failed)

  system(%(echo "<li /><a href='#{filename}'>#{File.basename(filename.gsub('.html', ''))}</a> (#{status})" | tee -a #{@index_html}))
end