Class: JunitModel::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/junit_model/parser.rb

Overview

Parse a file path into a Junit::TestGroup

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.read_path(path) ⇒ Object



8
9
10
# File 'lib/junit_model/parser.rb', line 8

def self.read_path(path)
  Parser.new.read_path(path)
end

.read_string(string) ⇒ Object



12
13
14
# File 'lib/junit_model/parser.rb', line 12

def self.read_string(string)
  Parser.new.read_string(string)
end

Instance Method Details

#read_path(path) ⇒ Object



16
17
18
19
# File 'lib/junit_model/parser.rb', line 16

def read_path(path)
  test_file = File.read(path)
  read_string(test_file)
end

#read_string(string) ⇒ Object



21
22
23
24
25
# File 'lib/junit_model/parser.rb', line 21

def read_string(string)
  test_output_hash = XmlSimple.xml_in string
  test_group = build_test_group(test_output_hash)
  test_group
end