pact_junit_formatter 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pact_j_unit_formatter.rb +1 -0
- data/lib/pact_junit_formatter.rb +14 -10
- data/lib/pact_junit_formatter/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d729f5849bf67501264db4912395cc73b775392
|
4
|
+
data.tar.gz: 03bed1c616d1c695cf48bfe2c415168cdc68055b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e170b7c0ca768951a49e4a42511e0c3b38f1a06315444e7373875669f2185b5ce25fed12885522c6af43e65d14bf5e15561f390cef380366bed8f07c16d04ba5
|
7
|
+
data.tar.gz: 194acc49971e88212cfbadac319f94a5e2eed17a565eba38ad3be01e2e7fbc4cda8c0939e8794dcb895162320681d191de58e58f72c39c35eabc32817789ccc1
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pact_junit_formatter'
|
data/lib/pact_junit_formatter.rb
CHANGED
@@ -7,12 +7,15 @@ require 'rspec/core/formatters/base_formatter'
|
|
7
7
|
require 'pact_junit_formatter/version'
|
8
8
|
|
9
9
|
class PactJUnitFormatter < RSpec::Core::Formatters::BaseFormatter
|
10
|
-
RSpec::Core::Formatters.register(self, :dump_summary)
|
10
|
+
RSpec::Core::Formatters.register(self, :stop, :dump_summary)
|
11
|
+
|
12
|
+
def stop(notification)
|
13
|
+
@examples = rearrange(notification.notifications.map {|n| PactExample.new(n) })
|
14
|
+
end
|
11
15
|
|
12
16
|
def dump_summary(notification)
|
13
17
|
@notification = notification
|
14
|
-
|
15
|
-
xml_dump(examples)
|
18
|
+
xml_dump(@examples)
|
16
19
|
end
|
17
20
|
|
18
21
|
private
|
@@ -69,12 +72,12 @@ class PactJUnitFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
69
72
|
end
|
70
73
|
|
71
74
|
def dump_failed(example)
|
72
|
-
exception = example.example.
|
73
|
-
|
75
|
+
exception = example.example.exception
|
76
|
+
message = exception.message.gsub(/\e\[(\d+)m/, '')
|
74
77
|
|
75
78
|
dump_example(example) do
|
76
|
-
@xml.failure(message:
|
77
|
-
@xml.cdata!("#{
|
79
|
+
@xml.failure(message: message, type: exception.class.name) do
|
80
|
+
@xml.cdata!("#{message}\n#{example.notification.formatted_backtrace.join("\n")}")
|
78
81
|
end
|
79
82
|
end
|
80
83
|
end
|
@@ -91,9 +94,10 @@ class PactJUnitFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
91
94
|
end
|
92
95
|
|
93
96
|
class PactExample
|
94
|
-
attr_reader :example, :contract
|
95
|
-
def initialize(
|
96
|
-
@
|
97
|
+
attr_reader :notification, :example, :contract
|
98
|
+
def initialize(notification)
|
99
|
+
@notification = notification
|
100
|
+
@example = notification.example
|
97
101
|
@contract = JSON.parse(example.metadata[:pact_json])
|
98
102
|
end
|
99
103
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_junit_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taiki Ono
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- Rakefile
|
67
67
|
- bin/console
|
68
68
|
- bin/setup
|
69
|
+
- lib/pact_j_unit_formatter.rb
|
69
70
|
- lib/pact_junit_formatter.rb
|
70
71
|
- lib/pact_junit_formatter/version.rb
|
71
72
|
- pact_junit_formatter.gemspec
|