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.
@@ -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 |klass_name|
11
- klass = klass_name.constantize
12
- @reporters << klass.new
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]
@@ -5,6 +5,10 @@ module Barthes
5
5
  class Default
6
6
  include Term::ANSIColor
7
7
 
8
+ def initialize(opts={})
9
+ @opts = opts
10
+ end
11
+
8
12
  def before_feature(num, name)
9
13
  puts "#{name} (##{num})"
10
14
  end
@@ -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
- puts Nokogiri::XML(result).to_xml(indent: 2)
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
@@ -1,3 +1,3 @@
1
1
  module Barthes
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barthes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: