Class: RSpecLive::SuiteDisplay

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-live/display.rb

Instance Method Summary collapse

Constructor Details

#initialize(section) ⇒ SuiteDisplay

Returns a new instance of SuiteDisplay.



33
34
35
# File 'lib/rspec-live/display.rb', line 33

def initialize(section)
  @section = section
end

Instance Method Details

#show_examples(examples, suite_status, detailed_examples, verbosity) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rspec-live/display.rb', line 37

def show_examples(examples, suite_status, detailed_examples, verbosity)
  @section.clear
  @section.add_section :display => :block
  examples.map(&:status).each do |status|
    @section.add_section :content => character[status], :color => color[status]
  end
  @section.add_section :display => :block
  @section.add_section :content => "#{suite_status}", :display => :block
  @section.add_section :display => :block
  last_failed = true
  bullet_width = (detailed_examples.length-1).to_s.length
  detailed_examples.each_with_index do |example, index|
    bullet = "#{index+1}.".rjust(bullet_width+1, " ")
    @section.add_section :display => :block if (!last_failed && example.failed?)
    @section.add_section :content => example.details(verbosity), :display => :block, :color => color[example.status], :wrap => true, :bullet => bullet
    @section.add_section :display => :block if example.failed?
    last_failed = example.failed?
  end
  @section.refresh
end