rspec-rfc-helper 0.1.1 → 0.2.1

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
  SHA256:
3
- metadata.gz: 70198d865509bb78dbee62f9c508f3be7ad29cfc06ed755c9bce627de257e05a
4
- data.tar.gz: e8fcd38d397d04ff53ec7d6e4b6b15a4f1f434a3e5b2bdbda25a43772c49e381
3
+ metadata.gz: d2c175dc6472f0b7a8c77965b5c901f966c072df84291a5688776d91fb8311c5
4
+ data.tar.gz: e83cc059ea1fbd555b49f55b02cc7a0755298aba2280f4b7bcbd2f724770ef68
5
5
  SHA512:
6
- metadata.gz: 5f9d481fbc7af29fede62a88c200e2b353fd433a3a8c9a1a4063d35a67e0849b699bf59dc38adef468ca31fe2fab51880f585121cbd5d8fae571e6815c781629
7
- data.tar.gz: f7a4bdcd7c290f4897befddda8f84611bb9c1fb7f6330a2163b2eaf8a8a3e7161691128eb73da1aee49e9905b2f90acbc8ccc3b49174ec56f6ee9c7c133e9975
6
+ metadata.gz: ba94fbf149ae5ae3f5621670517659666ee9a7356144ab79636c18794e20bbfca02a54bf445ebf43e34f5b0572457e42c5d96e3249952556eeb1874cba42baae
7
+ data.tar.gz: 69f220d59a38ec71be0ec675ac2270a32d53c30e34d06aafb32982f2e25c2fd5e6c8ef8f5e93f4d80f0738d5ad5d7139d171b4e54cbc435c9faac6ebeae6a28f
data/CHANGELOG.md CHANGED
@@ -28,6 +28,23 @@ Please, keep them in this order when updating.
28
28
 
29
29
  ## [Unreleased]
30
30
 
31
+ ## [0.2.1] - 2024-10-02
32
+
33
+ ### Fixed
34
+
35
+ - Fixed spec status value based on the last run. It now uses the correct current status.
36
+
37
+ ## [0.2.0] - 2023-11-10 - JSON report and fixes
38
+
39
+ ### Added
40
+
41
+ - Support for beautified JSON reports
42
+ - Links to details in summary table
43
+
44
+ ### Fixed
45
+
46
+ - Don't display example type when empty
47
+
31
48
  ## [0.1.1] - 2023-11-10 - Fixes
32
49
 
33
50
  ### FIXED
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpec
4
+ module RfcHelper
5
+ ##
6
+ # Markdown renderer for specs
7
+ class JsonRenderer
8
+ ##
9
+ # @param specs [RSpec::RfcHelper::Specs]
10
+ def initialize(specs)
11
+ @specs = specs
12
+ end
13
+
14
+ ##
15
+ # Generates a report in JSON format.
16
+ #
17
+ # @return [String]
18
+ def render
19
+ json = {
20
+ name: @specs.name,
21
+ url: @specs.specs_url,
22
+ specs: specs,
23
+ sections: sections,
24
+ }
25
+
26
+ JSON.pretty_generate json
27
+ end
28
+
29
+ private
30
+
31
+ ##
32
+ # Extracts sections informations
33
+ #
34
+ # @return [Array<Hash>]
35
+ def sections
36
+ list = []
37
+
38
+ @specs.sections.each_pair do |number, section|
39
+ list.push id: section[:id],
40
+ title: section[:title],
41
+ number: number,
42
+ url: section[:url]
43
+ end
44
+
45
+ list
46
+ end
47
+
48
+ ##
49
+ # Extracts specs and examples
50
+ #
51
+ # @return [Array<Hash>]
52
+ def specs
53
+ list = []
54
+ @specs.specs.each do |spec|
55
+ list.push id: spec.id,
56
+ section: spec.section,
57
+ verb: spec.verb,
58
+ text: spec.text,
59
+ examples: examples(spec)
60
+ end
61
+
62
+ list
63
+ end
64
+
65
+ ##
66
+ # Extracts examples statuses from a spec
67
+ #
68
+ # @param spec [RSpec::RfcHelper::Spec]
69
+ #
70
+ # @return [Array<Hash>]
71
+ def examples(spec)
72
+ list = []
73
+ spec.examples.each do |example|
74
+ meta = example.metadata
75
+ list.push status: example.execution_result.status,
76
+ type: meta[:type],
77
+ location: meta[:location]
78
+ end
79
+
80
+ list
81
+ end
82
+ end
83
+ end
84
+ end
@@ -13,9 +13,9 @@ module RSpec
13
13
  unknown: 'gray',
14
14
 
15
15
  # Statuses from RSpec::Core::Example
16
- 'failed' => 'red',
17
- 'pending' => 'orange',
18
- 'passed' => 'green',
16
+ failed: 'red',
17
+ pending: 'orange',
18
+ passed: 'green',
19
19
  }.freeze
20
20
 
21
21
  ##
@@ -106,15 +106,16 @@ module RSpec
106
106
  # @param spec [RSpec::RfcHelper::Spec]
107
107
  #
108
108
  # @return [String]
109
- def detailed_spec_report_header(spec) # rubocop:disable Metrics/AbcSize
109
+ def detailed_spec_report_header(spec) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
110
110
  section = "#{spec.section} - #{@specs.sections[spec.section][:title]}"
111
111
  spec_link = if @specs.sections[spec.section][:url]
112
112
  "[#{section}](#{@specs.sections[spec.section][:url]})"
113
113
  else
114
114
  section
115
115
  end
116
+ anchor = spec.id ? "<a id=\"#{spec.id}\"></a>" : ''
116
117
  <<~MD.chomp
117
- ## #{status(spec.status, '○')} `#{spec.verb.upcase}` #{spec.id}
118
+ ## #{anchor}#{status(spec.status, '○')} `#{spec.verb.upcase}` #{spec.id}
118
119
 
119
120
  **Specification:** #{spec_link}
120
121
 
@@ -132,7 +133,8 @@ module RSpec
132
133
  lines = []
133
134
  spec.examples.each do |example|
134
135
  meta = example.metadata
135
- lines << "| #{status(meta[:last_run_status])} | `#{meta[:type]}`: `#{meta[:location]}` |"
136
+ type = meta[:type] ? "`#{meta[:type]}`: " : ''
137
+ lines << "| #{status(example.execution_result.status)} | #{type}`#{meta[:location]}` |"
136
138
  end
137
139
 
138
140
  return "**No related examples**\n" if lines.empty?
@@ -154,10 +156,10 @@ module RSpec
154
156
  #
155
157
  # @return [String]
156
158
  def main_table_row(spec)
157
- id = spec.id ? "`#{spec.id}`" : ''
158
159
  section = @specs.sections[spec.section]
159
160
  section_link = section[:url] ? "[#{spec.section}](#{section[:url]})" : spec.section
160
- "| #{status(spec.status)} | #{id} | #{section_link} | #{spec.verb} | #{paragraph(spec.text)} |"
161
+ id_link = spec.id ? "[`#{spec.id}`](##{spec.id})" : ''
162
+ "| #{status(spec.status)} | #{id_link} | #{section_link} | #{spec.verb} | #{paragraph(spec.text)} |"
161
163
  end
162
164
 
163
165
  ##
@@ -47,8 +47,9 @@ module RSpec
47
47
  def status
48
48
  value = :unknown
49
49
  @examples.each do |example|
50
- return :failing if example.metadata[:last_run_status] == 'failed'
51
- return :has_pending if example.metadata[:last_run_status] == 'pending'
50
+ return :failing if example.execution_result.status == :failed
51
+ return :has_pending if example.execution_result.status == :pending
52
+ raise "Unhandled example status: #{example.execution_result.status}" if example.execution_result.status != :passed
52
53
 
53
54
  value = :pass
54
55
  end
@@ -4,13 +4,14 @@ require 'yaml'
4
4
 
5
5
  require_relative 'spec'
6
6
  require_relative 'markdown_renderer'
7
+ require_relative 'json_renderer'
7
8
 
8
9
  module RSpec
9
10
  module RfcHelper
10
11
  ##
11
12
  # Spec collection
12
13
  class Specs
13
- attr_reader :name, :specs_url, :sections
14
+ attr_reader :name, :specs_url, :sections, :specs
14
15
 
15
16
  ##
16
17
  # Instantiates a Spec collection from a YAML file.
@@ -124,6 +125,14 @@ module RSpec
124
125
  File.write file, RSpec::RfcHelper::MarkdownRenderer.new(self).render
125
126
  end
126
127
 
128
+ ##
129
+ # Saves the report in JSON
130
+ #
131
+ # @param file [String] Output file path
132
+ def save_json_report(file)
133
+ File.write file, RSpec::RfcHelper::JsonRenderer.new(self).render
134
+ end
135
+
127
136
  private
128
137
 
129
138
  ##
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rspec
4
4
  module RfcHelper
5
- VERSION = '0.1.1'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -30,5 +30,11 @@ module RSpec
30
30
 
31
31
  @specs.save_markdown_report file
32
32
  end
33
+
34
+ def self.save_json_report(file)
35
+ raise 'Did you start?' unless @specs
36
+
37
+ @specs.save_json_report file
38
+ end
33
39
  end
34
40
  end
data/report.md CHANGED
@@ -1,32 +1,32 @@
1
1
  # Compliance status: RSpec RFC Helper
2
2
 
3
- Report generated on 2023-11-07 22:11:05 +0100
3
+ Report generated on 2023-11-15 11:30:49 +0100
4
4
 
5
5
  Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blob/main/specification_example.md](https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blob/main/specification_example.md)
6
6
 
7
7
  | status | id | section | verb | text |
8
8
  |-------:|---:|---------|------|------|
9
- | <span style='color: green'>pass</span> | `features__have_version` | 2.1 | must | The RFC Helper <mark>MUST</mark> have a version number |
10
- | <span style='color: green'>pass</span> | `features__can_define_spec` | 2.1 | must | The RFC Helper <mark>MUST</mark> have methods to define specs that needs to be enforced and tracked. |
11
- | <span style='color: gray'>unknown</span> | `features__wrap_verbs` | 2.1 | must | To tackle this issue, the text used in a spec defined for the RFC Helper <mark>MUST</mark> wrap the right verb in the relevant <br> paragraph into double square brackets, like, for example `<mark>VERB</mark>`. The same paragraph MAY be used in multiple specs, <br> with everytime a different verb wrapper. <br> |
12
- | <span style='color: gray'>unknown</span> | `features__use_same_paragraph_twice` | 2.1 | may | To tackle this issue, the text used in a spec defined for the RFC Helper MUST wrap the right verb in the relevant <br> paragraph into double square brackets, like, for example `<mark>VERB</mark>`. The same paragraph <mark>MAY</mark> be used in multiple specs, <br> with everytime a different verb wrapper. <br> |
13
- | <span style='color: green'>pass</span> | `features__identify_specs_with_id` | 2.1 | must | Defined specs also need to be identifiable, so a unique ID <mark>MUST</mark> be assigned to them. |
14
- | <span style='color: gray'>unknown</span> | `features__no_verb_means_note` | 2.1 | note | When a portion of text is interesting but has no imperative verb in it, it still can be added, and the RFC Helper will <br> give it a status of "note". <br> |
15
- | <span style='color: green'>pass</span> | `reporting__rfc_tag` | 2.2 | must | Once the RFC helper is configured in a RSpec suite, it <mark>MUST</mark> handle examples tagged with the `rfc` tag. |
16
- | <span style='color: green'>pass</span> | `reporting__rfc_with_single_id_or_list` | 2.2 | must | The RFC helper <mark>MUST</mark> handle a single ID, as well as an array of IDs. |
17
- | <span style='color: green'>pass</span> | `reporting__export_method` | 2.2 | must | The RFC Helper <mark>MUST</mark> have at least one method to export the generated report in a file. |
18
- | <span style='color: gray'>unknown</span> | `reporting__export_date` | 2.2 | must | The report <mark>MUST</mark> contain the generation date. |
19
- | <span style='color: gray'>unknown</span> | `usage__two_ways` | 3 | should | To have some flexibility, the helper <mark>SHOULD</mark> be useable in two ways: using the module `RSpec::RfcHelper`, or the classes. <br> |
20
- | <span style='color: gray'>unknown</span> | `usage_module__start_method` | 3.1 | must | The `RSpec::RfcHelper` <mark>MUST</mark> have a method to "start" the helper |
21
- | <span style='color: gray'>unknown</span> | `usage_module__handle_examples` | 3.1 | must | It <mark>MUST</mark> have a method to add examples to specs once they are evaluated |
22
- | <span style='color: gray'>unknown</span> | `usage_module__export_method` | 3.1 | must | it <mark>MUST</mark> have a method to save the report |
9
+ | <span style='color: green'>pass</span> | [`features__have_version`](#features__have_version) | 2.1 | must | The RFC Helper <mark>MUST</mark> have a version number |
10
+ | <span style='color: green'>pass</span> | [`features__can_define_spec`](#features__can_define_spec) | 2.1 | must | The RFC Helper <mark>MUST</mark> have methods to define specs that needs to be enforced and tracked. |
11
+ | <span style='color: gray'>unknown</span> | [`features__wrap_verbs`](#features__wrap_verbs) | 2.1 | must | To tackle this issue, the text used in a spec defined for the RFC Helper <mark>MUST</mark> wrap the right verb in the relevant <br> paragraph into double square brackets, like, for example `<mark>VERB</mark>`. The same paragraph MAY be used in multiple specs, <br> with everytime a different verb wrapper. <br> |
12
+ | <span style='color: gray'>unknown</span> | [`features__use_same_paragraph_twice`](#features__use_same_paragraph_twice) | 2.1 | may | To tackle this issue, the text used in a spec defined for the RFC Helper MUST wrap the right verb in the relevant <br> paragraph into double square brackets, like, for example `<mark>VERB</mark>`. The same paragraph <mark>MAY</mark> be used in multiple specs, <br> with everytime a different verb wrapper. <br> |
13
+ | <span style='color: green'>pass</span> | [`features__identify_specs_with_id`](#features__identify_specs_with_id) | 2.1 | must | Defined specs also need to be identifiable, so a unique ID <mark>MUST</mark> be assigned to them. |
14
+ | <span style='color: gray'>unknown</span> | [`features__no_verb_means_note`](#features__no_verb_means_note) | 2.1 | note | When a portion of text is interesting but has no imperative verb in it, it still can be added, and the RFC Helper will <br> give it a status of "note". <br> |
15
+ | <span style='color: green'>pass</span> | [`reporting__rfc_tag`](#reporting__rfc_tag) | 2.2 | must | Once the RFC helper is configured in a RSpec suite, it <mark>MUST</mark> handle examples tagged with the `rfc` tag. |
16
+ | <span style='color: green'>pass</span> | [`reporting__rfc_with_single_id_or_list`](#reporting__rfc_with_single_id_or_list) | 2.2 | must | The RFC helper <mark>MUST</mark> handle a single ID, as well as an array of IDs. |
17
+ | <span style='color: green'>pass</span> | [`reporting__export_method`](#reporting__export_method) | 2.2 | must | The RFC Helper <mark>MUST</mark> have at least one method to export the generated report in a file. |
18
+ | <span style='color: gray'>unknown</span> | [`reporting__export_date`](#reporting__export_date) | 2.2 | must | The report <mark>MUST</mark> contain the generation date. |
19
+ | <span style='color: gray'>unknown</span> | [`usage__two_ways`](#usage__two_ways) | 3 | should | To have some flexibility, the helper <mark>SHOULD</mark> be useable in two ways: using the module `RSpec::RfcHelper`, or the classes. <br> |
20
+ | <span style='color: gray'>unknown</span> | [`usage_module__start_method`](#usage_module__start_method) | 3.1 | must | The `RSpec::RfcHelper` <mark>MUST</mark> have a method to "start" the helper |
21
+ | <span style='color: gray'>unknown</span> | [`usage_module__handle_examples`](#usage_module__handle_examples) | 3.1 | must | It <mark>MUST</mark> have a method to add examples to specs once they are evaluated |
22
+ | <span style='color: gray'>unknown</span> | [`usage_module__export_method`](#usage_module__export_method) | 3.1 | must | it <mark>MUST</mark> have a method to save the report |
23
23
  | <span style='color: gray'>unknown</span> | | 3.2 | note | The RFC Helper SHOULD be used directly by instantiating a class. |
24
24
  | <span style='color: gray'>unknown</span> | | 3.2 | note | The instance MUST provide methods to add sections |
25
25
  | <span style='color: gray'>unknown</span> | | 3.2 | note | The instance MUST provide methods to define the specs |
26
26
  | <span style='color: gray'>unknown</span> | | 3.2 | note | The instance MUST provide methods to generate the report |
27
27
  | <span style='color: gray'>unknown</span> | | 3.2 | note | The instance MAY provide methods to load sections and specs from a file |
28
28
 
29
- ## <span style='color: green'>○</span> `MUST` features__have_version
29
+ ## <a id="features__have_version"></a><span style='color: green'>○</span> `MUST` features__have_version
30
30
 
31
31
  **Specification:** 2.1 - Features
32
32
 
@@ -36,9 +36,9 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
36
36
 
37
37
  | Status | Reference |
38
38
  |:------:|-----------|
39
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper_spec.rb:4` |
39
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper_spec.rb:4` |
40
40
 
41
- ## <span style='color: green'>○</span> `MUST` features__can_define_spec
41
+ ## <a id="features__can_define_spec"></a><span style='color: green'>○</span> `MUST` features__can_define_spec
42
42
 
43
43
  **Specification:** 2.1 - Features
44
44
 
@@ -48,10 +48,10 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
48
48
 
49
49
  | Status | Reference |
50
50
  |:------:|-----------|
51
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper/spec_spec.rb:10` |
52
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper/specs_spec.rb:64` |
51
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper/spec_spec.rb:10` |
52
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper/specs_spec.rb:64` |
53
53
 
54
- ## <span style='color: gray'>○</span> `MUST` features__wrap_verbs
54
+ ## <a id="features__wrap_verbs"></a><span style='color: gray'>○</span> `MUST` features__wrap_verbs
55
55
 
56
56
  **Specification:** 2.1 - Features
57
57
 
@@ -59,7 +59,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
59
59
 
60
60
  **No related examples**
61
61
 
62
- ## <span style='color: gray'>○</span> `MAY` features__use_same_paragraph_twice
62
+ ## <a id="features__use_same_paragraph_twice"></a><span style='color: gray'>○</span> `MAY` features__use_same_paragraph_twice
63
63
 
64
64
  **Specification:** 2.1 - Features
65
65
 
@@ -67,7 +67,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
67
67
 
68
68
  **No related examples**
69
69
 
70
- ## <span style='color: green'>○</span> `MUST` features__identify_specs_with_id
70
+ ## <a id="features__identify_specs_with_id"></a><span style='color: green'>○</span> `MUST` features__identify_specs_with_id
71
71
 
72
72
  **Specification:** 2.1 - Features
73
73
 
@@ -77,9 +77,9 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
77
77
 
78
78
  | Status | Reference |
79
79
  |:------:|-----------|
80
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper/specs_spec.rb:75` |
80
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper/specs_spec.rb:75` |
81
81
 
82
- ## <span style='color: gray'>○</span> `NOTE` features__no_verb_means_note
82
+ ## <a id="features__no_verb_means_note"></a><span style='color: gray'>○</span> `NOTE` features__no_verb_means_note
83
83
 
84
84
  **Specification:** 2.1 - Features
85
85
 
@@ -87,7 +87,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
87
87
 
88
88
  **No related examples**
89
89
 
90
- ## <span style='color: green'>○</span> `MUST` reporting__rfc_tag
90
+ ## <a id="reporting__rfc_tag"></a><span style='color: green'>○</span> `MUST` reporting__rfc_tag
91
91
 
92
92
  **Specification:** 2.2 - Reporting
93
93
 
@@ -97,9 +97,9 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
97
97
 
98
98
  | Status | Reference |
99
99
  |:------:|-----------|
100
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper/specs_spec.rb:91` |
100
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper/specs_spec.rb:91` |
101
101
 
102
- ## <span style='color: green'>○</span> `MUST` reporting__rfc_with_single_id_or_list
102
+ ## <a id="reporting__rfc_with_single_id_or_list"></a><span style='color: green'>○</span> `MUST` reporting__rfc_with_single_id_or_list
103
103
 
104
104
  **Specification:** 2.2 - Reporting
105
105
 
@@ -109,9 +109,9 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
109
109
 
110
110
  | Status | Reference |
111
111
  |:------:|-----------|
112
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper/specs_spec.rb:91` |
112
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper/specs_spec.rb:91` |
113
113
 
114
- ## <span style='color: green'>○</span> `MUST` reporting__export_method
114
+ ## <a id="reporting__export_method"></a><span style='color: green'>○</span> `MUST` reporting__export_method
115
115
 
116
116
  **Specification:** 2.2 - Reporting
117
117
 
@@ -121,9 +121,9 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
121
121
 
122
122
  | Status | Reference |
123
123
  |:------:|-----------|
124
- | <span style='color: green'>passed</span> | ``: `./spec/rspec/rfc_helper/specs_spec.rb:103` |
124
+ | <span style='color: green'>passed</span> | `./spec/rspec/rfc_helper/specs_spec.rb:103` |
125
125
 
126
- ## <span style='color: gray'>○</span> `MUST` reporting__export_date
126
+ ## <a id="reporting__export_date"></a><span style='color: gray'>○</span> `MUST` reporting__export_date
127
127
 
128
128
  **Specification:** 2.2 - Reporting
129
129
 
@@ -131,7 +131,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
131
131
 
132
132
  **No related examples**
133
133
 
134
- ## <span style='color: gray'>○</span> `SHOULD` usage__two_ways
134
+ ## <a id="usage__two_ways"></a><span style='color: gray'>○</span> `SHOULD` usage__two_ways
135
135
 
136
136
  **Specification:** 3 - Usage
137
137
 
@@ -139,7 +139,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
139
139
 
140
140
  **No related examples**
141
141
 
142
- ## <span style='color: gray'>○</span> `MUST` usage_module__start_method
142
+ ## <a id="usage_module__start_method"></a><span style='color: gray'>○</span> `MUST` usage_module__start_method
143
143
 
144
144
  **Specification:** 3.1 - Using the module
145
145
 
@@ -147,7 +147,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
147
147
 
148
148
  **No related examples**
149
149
 
150
- ## <span style='color: gray'>○</span> `MUST` usage_module__handle_examples
150
+ ## <a id="usage_module__handle_examples"></a><span style='color: gray'>○</span> `MUST` usage_module__handle_examples
151
151
 
152
152
  **Specification:** 3.1 - Using the module
153
153
 
@@ -155,7 +155,7 @@ Source specification: [https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blo
155
155
 
156
156
  **No related examples**
157
157
 
158
- ## <span style='color: gray'>○</span> `MUST` usage_module__export_method
158
+ ## <a id="usage_module__export_method"></a><span style='color: gray'>○</span> `MUST` usage_module__export_method
159
159
 
160
160
  **Specification:** 3.1 - Using the module
161
161
 
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rspec/rfc_helper/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rspec-rfc-helper'
7
+ spec.version = Rspec::RfcHelper::VERSION
8
+ spec.authors = ['Manuel Tancoigne']
9
+ spec.email = ['manu@experimentslabs.com']
10
+
11
+ spec.summary = 'RSpec plugin to track RFC compliance'
12
+ spec.description = 'Helps keeping track of specifications with more context than just RSpec examples'
13
+ spec.homepage = 'https://gitlab.com/experimentslabs/rspec-rfc-helper'
14
+ spec.required_ruby_version = '>= 3.1.2'
15
+
16
+ spec.metadata['rubygems_mfa_required'] = 'true'
17
+
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://gitlab.com/experimentslabs/rspec-rfc-helper'
20
+ spec.metadata['changelog_uri'] = 'https://gitlab.com/experimentslabs/rspec-rfc-helper/-/blob/main/CHANGELOG.md'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (File.expand_path(f) == __FILE__) ||
27
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
28
+ end
29
+ end
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ spec.add_dependency 'rspec', '~> 3.0'
36
+ end
@@ -0,0 +1,12 @@
1
+ module RSpec
2
+ module RfcHelper
3
+ class JsonRenderer
4
+ @specs: Specs
5
+
6
+ def examples: -> Array[Hash[Symbol, untyped]]
7
+ def render: -> String
8
+ def sections: -> Array[Hash[Symbol, untyped]]
9
+ def specs: -> Array[Hash[Symbol, untyped]]
10
+ end
11
+ end
12
+ end
@@ -18,6 +18,7 @@ module RSpec
18
18
  def each: -> void
19
19
  def find: -> Spec
20
20
  def ids: -> Array[Symbol]
21
+ def save_json_report: -> void
21
22
  def save_markdown_report: -> void
22
23
  def section_id: -> Symbol
23
24
  end
@@ -7,6 +7,8 @@ module RSpec
7
7
 
8
8
  def self.add_example: -> void
9
9
  def self.load_specs: -> void
10
+ def self.save_json_report: -> untyped
11
+ def self.save_markdown_report: -> untyped
10
12
  def self.start_from_file: -> void
11
13
  end
12
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rfc-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Tancoigne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-10 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -40,12 +40,15 @@ files:
40
40
  - README.md
41
41
  - Rakefile
42
42
  - lib/rspec/rfc_helper.rb
43
+ - lib/rspec/rfc_helper/json_renderer.rb
43
44
  - lib/rspec/rfc_helper/markdown_renderer.rb
44
45
  - lib/rspec/rfc_helper/spec.rb
45
46
  - lib/rspec/rfc_helper/specs.rb
46
47
  - lib/rspec/rfc_helper/version.rb
47
48
  - report.md
49
+ - rspec-rfc-helper.gemspec
48
50
  - sig/rspec/rfc_helper.rbs
51
+ - sig/rspec/rfc_helper/json_renderer.rbs
49
52
  - sig/rspec/rfc_helper/markdown_renderer.rbs
50
53
  - sig/rspec/rfc_helper/spec.rbs
51
54
  - sig/rspec/rfc_helper/specs.rbs