Module: MotoWebEngine::ApplicationHelper

Defined in:
app/helpers/moto_web_engine/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#bgcolor_result(result) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/moto_web_engine/application_helper.rb', line 4

def bgcolor_result(result)
  case result.to_sym
  when :pending
    '#ffeeee'
  when :running
    '#ffcc00'
  when :passed
    '#00ff00'
  when :failure
    '#ff0000'
  when :error
    '#cc0099'
  when :skipped
    '#0066ff'
  else
    '#ffffff'
  end     
end

#duration(d) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'app/helpers/moto_web_engine/application_helper.rb', line 23

def duration(d)
  return '-' if d.nil?
  secs = d.to_i % 60
  mins = d.to_i / 60
  fraction = (d - d.to_i).round(3).to_s[2..-1]
  return "0.#{fraction}\"" if mins == 0 && secs == 0
  return "#{secs}.#{fraction}\"" if mins == 0
  "#{mins}'#{secs}.#{fraction}\""
end