rspec-ndjson-formatter 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 316080a332565d07d33c3d9fb9634c9e90400326
4
- data.tar.gz: 4320b06b6a6b2ad7908c96d36efb0dd87857fb7f
3
+ metadata.gz: 7269ff4c33900964a86b89c80ebe31172af591ac
4
+ data.tar.gz: 417678e47ae2876b8b7b60fbad68cec0277de1be
5
5
  SHA512:
6
- metadata.gz: eccba82016f6e2767de0765fd72190ae992da15068b0d006f31c14534434d4985b37791b40adb3efc1880914d4ff24ce001a99e8700d99ed37be4010c4c330b8
7
- data.tar.gz: 89aef63188646cbeb7deb1e27ff837ba43099a7da1cf05af97b22b4b2ed9b20b0bb388299a882f162530e6810404efdd511d1359ba54ad4b01fa339bbfc44823
6
+ metadata.gz: e5566b91fe020f4017cfb6e77deb1325faf6cfa2c342b7207d2f6bcd19617215e8457059e8a04baa6c165c849e85291ccad27f1a2fb73e773921c1476c86d4f1
7
+ data.tar.gz: 044bf91c84e9fe3bc859142c7cd7fbffa054a7e94525c99306f0a7cdad7d5a10a1a414436e81f42fff6065b2eab82af00bb1600e0f3242be9a437bb1e4c261f2
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [1.1.0] - 2019-01-20
8
+
9
+ ### Added
10
+
11
+ - output test result status and failure/pending messages
12
+
13
+ ## [1.0.0] - 2019-01-19
14
+
15
+ ### Added
16
+
17
+ - output information about tests without result status, suitable for use with `rspec --dry-run`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-ndjson-formatter (1.0.0)
4
+ rspec-ndjson-formatter (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,7 +2,13 @@ require "ndjson_formatter/version"
2
2
  require "json"
3
3
 
4
4
  class NdjsonFormatter
5
- RSpec::Core::Formatters.register self, :stop, :example_started, :example_group_started
5
+ RSpec::Core::Formatters.register self,
6
+ :stop,
7
+ :example_started,
8
+ :example_passed,
9
+ :example_failed,
10
+ :example_pending,
11
+ :example_group_started
6
12
 
7
13
  def initialize(io)
8
14
  @io = io
@@ -34,6 +40,23 @@ class NdjsonFormatter
34
40
  })
35
41
  end
36
42
 
43
+ def example_passed(example_notification)
44
+ update_testable(example_notification.example, status: "passed")
45
+ end
46
+
47
+ def example_failed(failed_example_notification)
48
+ update_testable(failed_example_notification.example,
49
+ status: "failed",
50
+ message: failed_example_notification.message_lines,
51
+ backtrace: failed_example_notification.formatted_backtrace)
52
+ end
53
+
54
+ def example_pending(example_notification)
55
+ update_testable(example_notification.example,
56
+ status: "pending",
57
+ message: Array(example_notification.example.execution_result.pending_message))
58
+ end
59
+
37
60
  def stop(_arg)
38
61
  dump
39
62
  end
@@ -64,6 +87,10 @@ class NdjsonFormatter
64
87
  @testables[parentless_testable[:id]] = parentless_testable
65
88
  end
66
89
 
90
+ def update_testable(testable, attributes)
91
+ @testables[testable.id].merge!(attributes)
92
+ end
93
+
67
94
  def format_id(metadata)
68
95
  return unless metadata
69
96
  "#{metadata.fetch(:file_path)}[#{metadata.fetch(:scoped_id)}]"
@@ -1,3 +1,3 @@
1
1
  class NdjsonFormatter
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-ndjson-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Payne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-19 00:00:00.000000000 Z
11
+ date: 2019-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,6 +63,7 @@ files:
63
63
  - ".gitignore"
64
64
  - ".rspec"
65
65
  - ".travis.yml"
66
+ - CHANGELOG.md
66
67
  - Gemfile
67
68
  - Gemfile.lock
68
69
  - LICENSE.txt