Class: Webspicy::Tester::Reporter::FileSummary

Inherits:
Webspicy::Tester::Reporter show all
Defined in:
lib/webspicy/tester/reporter/file_summary.rb

Constant Summary

Constants inherited from Webspicy::Tester::Reporter

ErrorCount, HOOKS

Instance Attribute Summary collapse

Attributes inherited from Webspicy::Tester::Reporter

#io, #tester

Instance Method Summary collapse

Methods inherited from Webspicy::Tester::Reporter

#find, #init

Methods included from Support::Colorize

colorize, colorize_error, colorize_highlight, colorize_section, colorize_success

Constructor Details

#initialize(*args, &bl) ⇒ FileSummary

Returns a new instance of FileSummary.



6
7
8
9
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 6

def initialize(*args, &bl)
  super
  clear
end

Instance Attribute Details

#errors_countObject (readonly)

Returns the value of attribute errors_count.



10
11
12
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 10

def errors_count
  @errors_count
end

#spec_files_countObject (readonly)

Returns the value of attribute spec_files_count.



10
11
12
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 10

def spec_files_count
  @spec_files_count
end

Instance Method Details

#before_spec_fileObject



12
13
14
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 12

def before_spec_file
  @spec_files_count += 1
end

#clearObject



33
34
35
36
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 33

def clear
  @spec_files_count = 0
  @errors_count = 0
end

#reportObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 20

def report
  msg = "#{plural('spec file', spec_files_count)}, "\
        "#{plural('error', errors_count)}"
  if success?
    msg = colorize_success(msg, config)
  else
    msg = colorize_error(msg, config)
  end
  io.puts(msg)
  io.puts
  io.flush
end

#spec_file_error(e) ⇒ Object



16
17
18
# File 'lib/webspicy/tester/reporter/file_summary.rb', line 16

def spec_file_error(e)
  @errors_count += 1
end