Top Level Namespace

Defined Under Namespace

Modules: Cucumber

Constant Summary collapse

WINDOWS =
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/

Instance Method Summary collapse

Instance Method Details

#blue_text(text) ⇒ Object



81
82
83
84
85
86
# File 'lib/cucumber-repeat.rb', line 81

def blue_text(text)
  if ($coloured_output == true) then
    text = text.blue
  end
  return text
end

#green_text(text) ⇒ Object



60
61
62
63
64
65
# File 'lib/cucumber-repeat.rb', line 60

def green_text(text)
  if ($coloured_output == true) then
    text = text.green
  end
  return text
end

#red_text(text) ⇒ Object



67
68
69
70
71
72
# File 'lib/cucumber-repeat.rb', line 67

def red_text(text)
  if ($coloured_output == true) then
    text = text.red
  end
  return text
end

#run_scenario(scenario) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cucumber-repeat.rb', line 40

def run_scenario(scenario)
  scenario.steps.each do |step_details|
    begin
      step step_details.name.to_s, step_details.multiline_arg
      $stdout.puts "    " + green_text(step_details.name.strip)
      if (!step_details.multiline_arg.to_s.empty?) then
        $stdout.puts "  " + green_text(step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip)
      end
      step_details.status!(:passed)
    rescue Exception => e
      $stdout.puts "    " + red_text(step_details.name.strip)
      if (!step_details.multiline_arg.to_s.empty?) then
        $stdout.puts "  " + red_text(step_details.multiline_arg.to_s.gsub(/\e\[(\d+)m/, '').strip)
      end
      $stdout.puts e.to_s.red
      step_details.status!(:failed)
    end
  end
end

#yellow_text(text) ⇒ Object



74
75
76
77
78
79
# File 'lib/cucumber-repeat.rb', line 74

def yellow_text(text)
  if ($coloured_output == true) then
    text = text.yellow
  end
  return text
end