barthes 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/barthes/reporter.rb +10 -3
- data/lib/barthes/reporter/default.rb +4 -0
- data/lib/barthes/reporter/junit_xml.rb +13 -7
- data/lib/barthes/version.rb +1 -1
- metadata +1 -1
data/lib/barthes/reporter.rb
CHANGED
@@ -7,9 +7,16 @@ module Barthes
|
|
7
7
|
def initialize
|
8
8
|
@reporters = []
|
9
9
|
if Barthes::Config[:reporters]
|
10
|
-
Barthes::Config[:reporters].each do |
|
11
|
-
|
12
|
-
|
10
|
+
Barthes::Config[:reporters].each do |reporter|
|
11
|
+
if reporter.match(/^(.+)(\{.*\})$/)
|
12
|
+
klass_name, json_string = $1, $2
|
13
|
+
opts = JSON.parse(json_string)
|
14
|
+
klass = klass_name.constantize
|
15
|
+
@reporters << klass.new(opts)
|
16
|
+
else
|
17
|
+
klass = reporter.constantize
|
18
|
+
@reporters << klass.new
|
19
|
+
end
|
13
20
|
end
|
14
21
|
else
|
15
22
|
@reporters = [Reporter::Default.new]
|
@@ -4,7 +4,8 @@ require 'nokogiri'
|
|
4
4
|
module Barthes
|
5
5
|
class Reporter
|
6
6
|
class JunitXml
|
7
|
-
def initialize
|
7
|
+
def initialize(opts={})
|
8
|
+
@opts = opts
|
8
9
|
@xml = Builder::XmlMarkup.new
|
9
10
|
@xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
10
11
|
end
|
@@ -15,7 +16,17 @@ module Barthes
|
|
15
16
|
walk_json(feature)
|
16
17
|
end
|
17
18
|
end
|
18
|
-
|
19
|
+
xml = Nokogiri::XML(result).to_xml(indent: 2)
|
20
|
+
case @opts['output']
|
21
|
+
when nil, '$stdout'
|
22
|
+
$stdout.puts xml
|
23
|
+
when '$stderr'
|
24
|
+
$stderr.puts xml
|
25
|
+
else
|
26
|
+
File.open(@opts['output'], 'w') do |f|
|
27
|
+
f.puts xml
|
28
|
+
end
|
29
|
+
end
|
19
30
|
end
|
20
31
|
|
21
32
|
def walk_json(json, parents=[])
|
@@ -60,11 +71,6 @@ module Barthes
|
|
60
71
|
puts json
|
61
72
|
end
|
62
73
|
end
|
63
|
-
|
64
|
-
def render_testcase(xml, action)
|
65
|
-
xml.testcase do
|
66
|
-
end
|
67
|
-
end
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
data/lib/barthes/version.rb
CHANGED