class XCPretty::Reporter
Constants
- FILEPATH
Attributes
tests[R]
Public Class Methods
new(options)
click to toggle source
Calls superclass method
XCPretty::Formatter::new
# File lib/xcpretty/reporters/reporter.rb, line 15 def initialize(options) super(true, true) load_dependencies @filepath = options[:path] || self.class::FILEPATH @test_count = 0 @fail_count = 0 @tests = [] end
Public Instance Methods
finish()
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 28 def finish FileUtils.mkdir_p(File.dirname(@filepath)) write_report end
format_failing_test(suite, test_case, reason, file)
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 33 def format_failing_test(suite, test_case, reason, file) @test_count += 1 @fail_count += 1 @tests.push("#{test_case} in #{file} FAILED: #{reason}") end
format_passing_test(suite, test_case, time)
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 39 def format_passing_test(suite, test_case, time) @test_count += 1 @tests.push("#{test_case} PASSED") end
format_pending_test(classname, test_case)
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 44 def format_pending_test(classname, test_case) @test_count += 1 @tests.push("#{test_case} IS PENDING") end
handle(line)
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 24 def handle(line) @parser.parse(line) end
load_dependencies()
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 8 def load_dependencies unless @@loaded ||= false require 'fileutils' @@loaded = true end end
write_report()
click to toggle source
# File lib/xcpretty/reporters/reporter.rb, line 49 def write_report File.open(@filepath, 'w') do |f| # WAT: get rid of these locals. BTW Cucumber fails if you remove them output_string = @tests.join("\n") output_string += "\nFINISHED RUNNING #{@test_count} TESTS WITH #{@fail_count} FAILURES" f.write output_string end end