Class: Teaspoon::Formatter::RspecHtml

Inherits:
Base
  • Object
show all
Defined in:
lib/teaspoon/formatter/rspec_html.rb

Defined Under Namespace

Modules: Templates Classes: Template

Constant Summary

Constants inherited from Base

Base::RESERVED_PARAMS

Instance Attribute Summary

Attributes inherited from Base

#errors, #failures, #passes, #pendings, #run_count, #total_count

Instance Method Summary collapse

Methods inherited from Base

#complete, #console, #coverage, #error, #exception, #result, #runner, #spec, #suite, #threshold_failure

Constructor Details

#initialize(*args) ⇒ RspecHtml

Returns a new instance of RspecHtml.



7
8
9
10
11
12
13
# File 'lib/teaspoon/formatter/rspec_html.rb', line 7

def initialize(*args)
  super
  @suite_start_template = template Templates::SUITE_START
  @suite_end_template = template Templates::SUITE_END
  @spec_template = template Templates::SPEC
  @current_suite = []
end

Instance Method Details

#log_result(result) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/teaspoon/formatter/rspec_html.rb', line 31

def log_result(result)
  while !@current_suite.empty?
    log_suite_end
  end

  log_template template(Templates::FOOTER), result
end

#log_runner(result) ⇒ Object



15
16
17
# File 'lib/teaspoon/formatter/rspec_html.rb', line 15

def log_runner(result)
  log_template template(Templates::HEADER), result
end

#log_spec(result) ⇒ Object



27
28
29
# File 'lib/teaspoon/formatter/rspec_html.rb', line 27

def log_spec(result)
  log_template @spec_template, result
end

#log_suite(result) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/teaspoon/formatter/rspec_html.rb', line 19

def log_suite(result)
  while !@current_suite.empty? && @current_suite.size > result.level
    log_suite_end
  end

  log_suite_start result
end