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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44acd8262262a0d597e2c7798fce00b59626dea1
4
- data.tar.gz: a7db7c18bc636aae701862c2df441bfa92452275
3
+ metadata.gz: 8d729f5849bf67501264db4912395cc73b775392
4
+ data.tar.gz: 03bed1c616d1c695cf48bfe2c415168cdc68055b
5
5
  SHA512:
6
- metadata.gz: a82a0bc73fc78d9f752c31e97b8dab55d36749cd5c8f3b55a1265aa7caa2d85e597d4d2b267a23d83ac0c3128969449f9b9864803bd8ed8f60a3da2b24621172
7
- data.tar.gz: e796a6b70e9a1354040d6c7ea98cd583de77374c1074e256efb95667d1d1d69a2430f73828622f88310e9121cbdfe0de8ed53e3bd5d5e81ecd74239e9287b39e
6
+ metadata.gz: e170b7c0ca768951a49e4a42511e0c3b38f1a06315444e7373875669f2185b5ce25fed12885522c6af43e65d14bf5e15561f390cef380366bed8f07c16d04ba5
7
+ data.tar.gz: 194acc49971e88212cfbadac319f94a5e2eed17a565eba38ad3be01e2e7fbc4cda8c0939e8794dcb895162320681d191de58e58f72c39c35eabc32817789ccc1
@@ -0,0 +1 @@
1
+ require 'pact_junit_formatter'
@@ -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
- examples = rearrange(notification.examples.map {|e| PactExample.new(e) })
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.execution_result.exception
73
- backtrace = example.example.formatted_backtrace
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: exception.to_s, type: exception.class.name) do
77
- @xml.cdata!("#{exception.message}\n#{backtrace.join("\n")}")
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(example)
96
- @example = example
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
 
@@ -1,3 +1,3 @@
1
1
  module PactJunitFormatter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
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.0
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-16 00:00:00.000000000 Z
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