Class: Cucumber::Formatter::HtmlBuilder

Inherits:
Builder::XmlMarkup
  • Object
show all
Defined in:
lib/cucumber/formatter/html_builder.rb

Defined Under Namespace

Classes: InvalidEmbedTypeError

Constant Summary collapse

VALID_EMBED_TYPES =
[:text, :image].freeze

Instance Method Summary collapse

Instance Method Details

#build_document!Object



27
28
29
30
31
32
33
# File 'lib/cucumber/formatter/html_builder.rb', line 27

def build_document!
  declare! # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  self << '<html xmlns ="http://www.w3.org/1999/xhtml">'

  set_head_tags
end

#declare!Object



23
24
25
# File 'lib/cucumber/formatter/html_builder.rb', line 23

def declare!
  super(:DOCTYPE, :html, :PUBLIC, '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd')
end

#embed(type: nil, src: nil, label: nil, id: nil) ⇒ Object



19
20
21
# File 'lib/cucumber/formatter/html_builder.rb', line 19

def embed(type: nil, src: nil, label: nil, id: nil)
  prepend_to_span('embed', string_to_embed(type: type, src: src, label: label, id: id))
end

#format_features!(features) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cucumber/formatter/html_builder.rb', line 35

def format_features!(features)
  step_count = features && features.step_count || 0

  self << '<body>'
  self << "<!-- Step count #{step_count}-->"
  self << '<div class="cucumber">'

  div(id: 'cucumber-header') do
    div(id: 'label') do
      h1 'Cucumber Features'
    end

    summary_div
  end
end