rspec-openapi 0.3.15 → 0.3.16

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: 76a7b33ccfea2d2fbaf9cb45b49171c46c0b6b9df44280ac6d6bf0f864aedb60
4
- data.tar.gz: d52a3651c1dc945711c378d39e53867f518c9b8aed2d6bf7502c00aade767856
3
+ metadata.gz: 799f75b4bb5607dff7ab4a556b5d27d72b587af88636e7b510533724a1ede97a
4
+ data.tar.gz: 71aedf1e1610f23106dd778a2b9d9f4677c73c280127ff61300afa024068bef8
5
5
  SHA512:
6
- metadata.gz: f8eac8961aa0b71a48f3af48c118dad88b8e4e90767dfb37c87d0902422a9ed6bea2c43cf87c713c209be0d7284f114cd455d49069b8521d3d34ad6ffcd901eb
7
- data.tar.gz: d2a984317e8b93f8f2f29540c2a34af9fa89b46aadbdd300cc2247212d338530aff7d53aae75b27cabbd1d21ea3a30698051e1cd836509bf36c202f5c538eec9
6
+ metadata.gz: e65865ca2d26e66f6fa560fe3fc157a491786ba7243d267dcdd4f22e3e5c28c29895384a32b8b19c095317a0447453ad292bfe91ff4059395f8ee08f0763f738
7
+ data.tar.gz: fda7f3678e952359a356069353d0756890edd7da50e4cd422489db091f9223439e1385d7939f27bd55d4c4afc7e6760bd55805275f932345273e6d5528a2b036
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v0.3.16
2
+
3
+ * Use `media_type` instead of `content_type` for Rails 6.1
4
+ [#26](https://github.com/k0kubun/rspec-openapi/pull/26)
5
+ * Avoid crashing the after suite hook when it fails to build schema
6
+ [#27](https://github.com/k0kubun/rspec-openapi/pull/27)
7
+
1
8
  ## v0.3.15
2
9
 
3
10
  * Fix an error when Content-Disposition header is inline
@@ -6,6 +6,7 @@ require 'rspec/openapi/schema_file'
6
6
  require 'rspec/openapi/schema_merger'
7
7
 
8
8
  records = []
9
+ records_errors = []
9
10
 
10
11
  RSpec.configuration.after(:each) do |example|
11
12
  if example.metadata[:type] == :request && example.metadata[:openapi] != false
@@ -19,7 +20,21 @@ RSpec.configuration.after(:suite) do
19
20
  RSpec::OpenAPI::SchemaFile.new(RSpec::OpenAPI.path).edit do |spec|
20
21
  RSpec::OpenAPI::SchemaMerger.reverse_merge!(spec, RSpec::OpenAPI::DefaultSchema.build(title))
21
22
  records.each do |record|
22
- RSpec::OpenAPI::SchemaMerger.reverse_merge!(spec, RSpec::OpenAPI::SchemaBuilder.build(record))
23
+ begin
24
+ RSpec::OpenAPI::SchemaMerger.reverse_merge!(spec, RSpec::OpenAPI::SchemaBuilder.build(record))
25
+ rescue => e # e.g. SchemaBuilder raises a NotImplementedError
26
+ # NOTE: Don't fail the build
27
+ records_errors << [e, record]
28
+ end
23
29
  end
24
30
  end
31
+ if records_errors.any?
32
+ error_message = <<~EOS
33
+ RSpec::OpenAPI got errors building #{records_errors.size} requests
34
+
35
+ #{records_errors.map {|e, record| "#{e.inspect}: #{record.inspect}" }.join("\n")}
36
+ EOS
37
+ colorizer = ::RSpec::Core::Formatters::ConsoleCodes
38
+ RSpec.configuration.reporter.message colorizer.wrap(error_message, :failure)
39
+ end
25
40
  end
@@ -40,13 +40,13 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
40
40
  path_params: raw_path_params(request),
41
41
  query_params: request.query_parameters,
42
42
  request_params: raw_request_params(request),
43
- request_content_type: request.content_type,
43
+ request_content_type: request.media_type,
44
44
  summary: summary,
45
45
  tags: tags,
46
46
  description: RSpec::OpenAPI.description_builder.call(example),
47
47
  status: response.status,
48
48
  response_body: response_body,
49
- response_content_type: response.content_type,
49
+ response_content_type: response.media_type,
50
50
  response_content_disposition: response.header["Content-Disposition"],
51
51
  ).freeze
52
52
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module OpenAPI
3
- VERSION = '0.3.15'
3
+ VERSION = '0.3.16'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.15
4
+ version: 0.3.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-24 00:00:00.000000000 Z
11
+ date: 2021-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -75,7 +75,7 @@ metadata:
75
75
  homepage_uri: https://github.com/k0kubun/rspec-openapi
76
76
  source_code_uri: https://github.com/k0kubun/rspec-openapi
77
77
  changelog_uri: https://github.com/k0kubun/rspec-openapi/blob/master/CHANGELOG.md
78
- post_install_message:
78
+ post_install_message:
79
79
  rdoc_options: []
80
80
  require_paths:
81
81
  - lib
@@ -90,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.2.3
94
- signing_key:
93
+ rubygems_version: 3.1.6
94
+ signing_key:
95
95
  specification_version: 4
96
96
  summary: Generate OpenAPI schema from RSpec request specs
97
97
  test_files: []