Class: Relevance::Tarantula::IOReporter

Inherits:
Object
  • Object
show all
Includes:
Relevance::Tarantula
Defined in:
lib/relevance/tarantula/io_reporter.rb

Defined Under Namespace

Classes: IOResultOverview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Relevance::Tarantula

#log, #rails_root, #tarantula_home, #verbose

Constructor Details

#initialize(io) ⇒ IOReporter

Returns a new instance of IOReporter.



9
10
11
12
# File 'lib/relevance/tarantula/io_reporter.rb', line 9

def initialize(io)
  @io = io
  @results = Struct.new(:successes, :failures).new([], [])
end

Instance Attribute Details

#ioObject

Returns the value of attribute io.



4
5
6
# File 'lib/relevance/tarantula/io_reporter.rb', line 4

def io
  @io
end

#resultsObject

Returns the value of attribute results.



4
5
6
# File 'lib/relevance/tarantula/io_reporter.rb', line 4

def results
  @results
end

Instance Method Details

#finish_report(test_name) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/relevance/tarantula/io_reporter.rb', line 24

def finish_report(test_name)
  unless (failures).empty?
    io.puts "****** FAILURES"
    failures.each do |failure|
      io.puts "#{failure.code}: #{failure.url}"
    end
    raise "#{failures.size} failures"
  end
end

#report(result) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/relevance/tarantula/io_reporter.rb', line 14

def report(result)
  return if result.nil?
  
  unless result.success # collection = result.success ? results.successes : results.failures
    results.failures << IOResultOverview.new(
      result.code, result.url
    )
  end
end