Class: XCPretty::TestAnything

Inherits:
Knock show all
Defined in:
lib/xcpretty/formatters/tap.rb

Constant Summary

Constants inherited from Knock

Knock::FAIL, Knock::PASS

Constants inherited from Formatter

Formatter::ASCII_ERROR, Formatter::ERROR

Constants included from FormatMethods

FormatMethods::EMPTY

Constants included from ANSI

ANSI::COLORS, ANSI::EFFECT, ANSI::FORMATTED_MATCHER

Instance Attribute Summary collapse

Attributes inherited from Formatter

#parser

Attributes included from ANSI

#colorize

Instance Method Summary collapse

Methods inherited from Knock

#format_failure_diagnostics

Methods inherited from Formatter

#format_compile_error, #format_duplicate_symbols, #format_error, #format_undefined_symbols, #optional_newline, #pretty_format, #use_unicode?

Methods included from FormatMethods

#format_analyze, #format_build_target, #format_check_dependencies, #format_clean, #format_clean_remove, #format_clean_target, #format_codesign, #format_compile, #format_compile_command, #format_compile_error, #format_compile_xib, #format_copy_strings_file, #format_cpresource, #format_duplicate_symbols, #format_error, #format_generate_dsym, #format_libtool, #format_linking, #format_pbxcp, #format_phase_script_execution, #format_preprocess, #format_process_info_plist, #format_process_pch, #format_test_run_finished, #format_test_run_started, #format_test_suite_started, #format_tiffutil, #format_touch, #format_undefined_symbols

Methods included from ANSI

#ansi_parse, #applied_effects, #colorize?, #cyan, #green, #red, #strip, #white, #yellow

Constructor Details

#initialize(unicode, color) ⇒ TestAnything

Returns a new instance of TestAnything.



7
8
9
10
# File 'lib/xcpretty/formatters/tap.rb', line 7

def initialize unicode, color
  super
  @counter = 0
end

Instance Attribute Details

#counterObject (readonly)

Returns the value of attribute counter.



5
6
7
# File 'lib/xcpretty/formatters/tap.rb', line 5

def counter
  @counter
end

Instance Method Details

#format_failing_test(test_suite, test_case, reason, file) ⇒ Object



17
18
19
20
21
# File 'lib/xcpretty/formatters/tap.rb', line 17

def format_failing_test(test_suite, test_case, reason, file)
  increment_counter
  "#{FAIL} #{counter} - #{test_case}" +
  format_failure_diagnostics(test_suite, test_case, reason, file)
end

#format_passing_test(suite, test_case, time) ⇒ Object



12
13
14
15
# File 'lib/xcpretty/formatters/tap.rb', line 12

def format_passing_test(suite, test_case, time)
  increment_counter
  "#{PASS} #{counter} - #{test_case}"
end

#format_pending_test(test_suite, test_case) ⇒ Object



23
24
25
26
# File 'lib/xcpretty/formatters/tap.rb', line 23

def format_pending_test(test_suite, test_case)
  increment_counter
  "#{FAIL} #{counter} - #{test_case} # TODO Not written yet"
end

#format_test_summary(executed_message, failures_per_suite) ⇒ Object



28
29
30
# File 'lib/xcpretty/formatters/tap.rb', line 28

def format_test_summary(executed_message, failures_per_suite)
  counter > 0 ? "1..#{counter}" : ''
end