Module: PrettyFace::Formatter::ViewHelper

Included in:
Html
Defined in:
lib/pretty_face/formatter/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#failed_scenario?(scenario) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/pretty_face/formatter/view_helper.rb', line 44

def failed_scenario?(scenario)
  scenario.status == :failed
end

#scenario_average_duration(features) ⇒ Object



30
31
32
33
34
# File 'lib/pretty_face/formatter/view_helper.rb', line 30

def scenario_average_duration(features)
  scenarios = features.collect { |feature| feature.scenarios }
  durations = scenarios.flatten.collect { |scenario| scenario.duration }
  format_duration get_average_from_float_array durations
end

#scenario_countObject



15
16
17
# File 'lib/pretty_face/formatter/view_helper.rb', line 15

def scenario_count
  @step_mother.scenarios.length
end

#scenarios_summary_for(status) ⇒ Object



36
37
38
# File 'lib/pretty_face/formatter/view_helper.rb', line 36

def scenarios_summary_for(status)
  summary_percent(@step_mother.scenarios(status).length, scenario_count)
end

#start_timeObject



7
8
9
# File 'lib/pretty_face/formatter/view_helper.rb', line 7

def start_time
  @tests_started.strftime("%a %B %-d, %Y at %H:%M:%S")
end

#step_average_duration(features) ⇒ Object



23
24
25
26
27
28
# File 'lib/pretty_face/formatter/view_helper.rb', line 23

def step_average_duration(features)
  scenarios = features.collect { |feature| feature.scenarios }
  steps = scenarios.flatten.collect { |scenario| scenario.steps }
  durations = steps.flatten.collect { |step| step.duration }
  format_duration get_average_from_float_array durations
end

#step_countObject



11
12
13
# File 'lib/pretty_face/formatter/view_helper.rb', line 11

def step_count
  @step_mother.steps.length
end

#steps_summary_for(status) ⇒ Object



40
41
42
# File 'lib/pretty_face/formatter/view_helper.rb', line 40

def steps_summary_for(status)
  summary_percent(@step_mother.steps(status).length, step_count)
end

#total_durationObject



19
20
21
# File 'lib/pretty_face/formatter/view_helper.rb', line 19

def total_duration
  @duration
end