class OnlyofficeRspecResultParser::ResultParser
Class with stored data about rspec result
Attributes
example_index[RW]
Public Class Methods
get_failed_cases_count_from_html(html_path)
click to toggle source
Get failed count @param [String] html_path path to file @return [Integer] failed count
# File lib/onlyoffice_rspec_result_parser/rspec_result_parser.rb, line 40 def get_failed_cases_count_from_html(html_path) page = Nokogiri::HTML(read_file(html_path)) result = RspecResult.new(page).parse_page return 0 unless result.valid_html? result.failed_count end
get_total_result_of_rspec_html(html_path)
click to toggle source
Get total case count @param [String] html_path path to file @return [Integer] total count
# File lib/onlyoffice_rspec_result_parser/rspec_result_parser.rb, line 51 def get_total_result_of_rspec_html(html_path) page = Nokogiri::HTML(read_file(html_path)) result = RspecResult.new(page).parse_page return '' unless result.valid_html? result.total end
parse_metadata(file)
click to toggle source
@param file [String] path to file @return [RspecResult] result of parsing
# File lib/onlyoffice_rspec_result_parser/rspec_result_parser.rb, line 30 def parse_metadata(file) page = Nokogiri::HTML(read_file(file)) parse_test_result(page, with_describe_info: false) end
parse_rspec_html(html_path)
click to toggle source
Parse rspec html @param [String] html_path path to file @return [Object] result of parse
# File lib/onlyoffice_rspec_result_parser/rspec_result_parser.rb, line 23 def parse_rspec_html(html_path) page = Nokogiri::HTML(read_file(html_path)) parse_test_result(page) end
Also aliased as: parse_rspec_html_string
parse_test_result(page, with_describe_info: true)
click to toggle source
@param page [String] data in page @param with_describe_info [Boolean] if
describe metadata should be included
@return [RspecResult] result of parsing
# File lib/onlyoffice_rspec_result_parser/rspec_result_parser.rb, line 63 def parse_test_result(page, with_describe_info: true) ResultParser.example_index = 0 RspecResult.new(page).parse_page(with_describe_info: with_describe_info) end
Private Class Methods
read_file(data)
click to toggle source
Read file from disk or use string @param data [String] filepath or data string @return [String] result of read
# File lib/onlyoffice_rspec_result_parser/rspec_result_parser.rb, line 73 def read_file(data) return data unless File.exist?(data) File.read(data) end