swagalicious 0.4.5 → 0.4.8

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: 8fe701583dd2d70b9be1dd659ce40864a5724e982fb3951034135f412bdcca01
4
- data.tar.gz: a78071f0d850a70b940dc8e07957241423a1742265cd026a38ca0915cfb2d4f4
3
+ metadata.gz: 36ac62aeb7dffb004e29a38b0141268f7b9b44f98537aee9fad8c022f09eb630
4
+ data.tar.gz: e2b4e39271810b7a37ab365eb0614382fd799b5ba6cffc1f5d8b1c9507e7d648
5
5
  SHA512:
6
- metadata.gz: 0c306f2b4cb881e8581a4c079b4565789a4cabc3df4388955dde7ca89519eca45234f6c15d7cb9b8550df311afbc5f009a133700cfc4003de5245422ec37db02
7
- data.tar.gz: 31e69267fef1575cd91652418c22a7a538c97c9698be86c147980b25b854c9f0918c02ffa26aa3c9863b875cc5912c38a40166255f326a9e9eb94031f9fdd890
6
+ metadata.gz: 3955a4ec404da45f989448ec940ad831f56eea5ea2c5a59e6fccf0b04afdf56c8cfabcc27c0ee9bb613d012f62da87905fb52d57048f7ee78d921a0b7f138736
7
+ data.tar.gz: 22e88cf6abaf4e78959bf4f43f93f3b2b5f48b6de6353f002cae46f27f381ccf461284a4a63ecc1aaa8d17ffff06a56f01076bcc94da3cf147986ff99d93e105
data/.gitignore CHANGED
@@ -7,5 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ *.gem
11
+
10
12
  # rspec failure tracking
11
13
  .rspec_status
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swagalicious (0.4.4)
5
- faraday (~> 1.3.0)
6
- json-schema (~> 2.8.1)
4
+ swagalicious (0.4.7)
5
+ faraday (~> 2.0)
6
+ faraday-rack
7
+ json-schema
7
8
  oj (~> 3.11.0)
8
- rspec (~> 3.10.0)
9
+ rspec (~> 3)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
@@ -24,18 +25,18 @@ GEM
24
25
  diff-lcs (1.5.0)
25
26
  factory_bot (6.1.0)
26
27
  activesupport (>= 5.0.0)
27
- faraday (1.3.1)
28
- faraday-net_http (~> 1.0)
29
- multipart-post (>= 1.2, < 3)
28
+ faraday (2.4.0)
29
+ faraday-net_http (~> 2.0)
30
30
  ruby2_keywords (>= 0.0.4)
31
- faraday-net_http (1.0.1)
31
+ faraday-net_http (2.1.0)
32
+ faraday-rack (2.0.0)
33
+ faraday (~> 2.0)
32
34
  i18n (1.10.0)
33
35
  concurrent-ruby (~> 1.0)
34
- json-schema (2.8.1)
35
- addressable (>= 2.4)
36
+ json-schema (3.0.0)
37
+ addressable (>= 2.8)
36
38
  method_source (1.0.0)
37
- minitest (5.15.0)
38
- multipart-post (2.2.0)
39
+ minitest (5.16.1)
39
40
  oj (3.11.8)
40
41
  pry (0.13.1)
41
42
  coderay (~> 1.1)
@@ -48,23 +49,23 @@ GEM
48
49
  rack-test (1.1.0)
49
50
  rack (>= 1.0, < 3)
50
51
  rake (12.3.3)
51
- rspec (3.10.0)
52
- rspec-core (~> 3.10.0)
53
- rspec-expectations (~> 3.10.0)
54
- rspec-mocks (~> 3.10.0)
55
- rspec-core (3.10.2)
56
- rspec-support (~> 3.10.0)
57
- rspec-expectations (3.10.2)
52
+ rspec (3.11.0)
53
+ rspec-core (~> 3.11.0)
54
+ rspec-expectations (~> 3.11.0)
55
+ rspec-mocks (~> 3.11.0)
56
+ rspec-core (3.11.0)
57
+ rspec-support (~> 3.11.0)
58
+ rspec-expectations (3.11.0)
58
59
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.10.0)
60
- rspec-mocks (3.10.3)
60
+ rspec-support (~> 3.11.0)
61
+ rspec-mocks (3.11.1)
61
62
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.10.0)
63
- rspec-support (3.10.3)
63
+ rspec-support (~> 3.11.0)
64
+ rspec-support (3.11.0)
64
65
  ruby2_keywords (0.0.5)
65
66
  tzinfo (2.0.4)
66
67
  concurrent-ruby (~> 1.0)
67
- zeitwerk (2.5.4)
68
+ zeitwerk (2.6.0)
68
69
 
69
70
  PLATFORMS
70
71
  ruby
@@ -1,5 +1,5 @@
1
1
  require "faraday"
2
- require "faraday/adapter/rack"
2
+ require "faraday/rack"
3
3
  require "rack"
4
4
  require "oj"
5
5
 
@@ -20,7 +20,7 @@ class Swagalicious
20
20
  end
21
21
 
22
22
  def app
23
- @app ||= Rack::Builder.parse_file("config.ru").first
23
+ @app ||= defined?(Rails) ? Rails.application : Rack::Builder.parse_file("config.ru").first
24
24
  end
25
25
 
26
26
  def client
@@ -30,15 +30,17 @@ class Swagalicious
30
30
  end
31
31
 
32
32
  def submit_request(metadata, mocked: false, mock_name: nil)
33
- request = RequestFactory.new.build_request(metadata, self)
33
+ request = RequestFactory.new.build_request(metadata, self)
34
+ uri = URI.parse(request[:path])
35
+ uri.path = uri.path.gsub("//", "/")
34
36
 
35
37
  response = if mocked
36
- file_name = File.basename(mock_name || URI.parse(request[:path]).path)
38
+ file_name = File.basename(mock_name || path)
37
39
 
38
40
  MockResponse.new(file_name)
39
41
  else
40
42
  client.public_send(request[:verb]) do |req|
41
- req.url request[:path].gsub("//", "/")
43
+ req.url uri.to_s
42
44
  req.headers = request[:headers]
43
45
  req.body = request[:payload]
44
46
  end
@@ -68,7 +70,7 @@ class Swagalicious
68
70
  metadata[:response][:requestBody][:content][mime_type][:examples][full_title][:value] = Oj.load(request[:payload]).dup
69
71
  end
70
72
 
71
- metadata[:response][:examples][mime_type] ||= {}
73
+ metadata[:response][:examples][mime_type] ||= {}
72
74
  metadata[:response][:examples][mime_type][full_title] = @body
73
75
  end
74
76
 
@@ -1,3 +1,3 @@
1
1
  class Swagalicious
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.8"
3
3
  end
data/lib/swagalicious.rb CHANGED
@@ -2,6 +2,12 @@ require "rspec/core"
2
2
 
3
3
  require_relative "./swagalicious/version"
4
4
 
5
+ begin
6
+ require "rspec/rails"
7
+ rescue LoadError
8
+ nil
9
+ end
10
+
5
11
  class Swagalicious
6
12
  class Error < StandardError; end
7
13
 
@@ -24,6 +30,11 @@ class Swagalicious
24
30
  c.add_setting :swagger_root
25
31
  c.add_setting :swagger_docs
26
32
  c.add_setting :swagger_dry_run
33
+
34
+ if defined?(Rails) && defined?(RSpec::Rails)
35
+ c.include RSpec::Rails::RequestExampleGroup, type: :doc
36
+ end
37
+
27
38
  c.extend Swagalicious::ExampleGroupHelpers, type: :doc
28
39
  c.include Swagalicious::ExampleHelpers, type: :doc
29
40
  end
data/swagalicious.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |spec|
4
4
  spec.name = "swagalicious"
5
5
  spec.version = Swagalicious::VERSION
6
6
  spec.authors = ["Eugene Howe"]
7
- spec.email = ["eugene@xtreme-computers.net"]
7
+ spec.email = ["eugene.howe@protonmail.com"]
8
8
 
9
9
  spec.summary = %q{RSwag without Rails}
10
10
  spec.description = %q{This gem is almost a straight copy and paste of https://github.com/rswag/rswag/tree/master/rswag-specs with the Rails specific code stripped out so it can be used in Rack applications that don't use Rails.}
@@ -24,10 +24,11 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "faraday", "~> 1.3.0"
28
- spec.add_dependency "json-schema", "~> 2.8.1"
29
- spec.add_dependency "oj", "~> 3.11.0"
30
- spec.add_dependency "rspec", "~> 3.10.0"
27
+ spec.add_dependency "faraday", "~> 2.0"
28
+ spec.add_dependency "faraday-rack"
29
+ spec.add_dependency "json-schema"
30
+ spec.add_dependency "oj", "~> 3.11.0"
31
+ spec.add_dependency "rspec", "~> 3"
31
32
 
32
33
  spec.add_development_dependency "factory_bot", "~> 6.1.0"
33
34
  spec.add_development_dependency "pry-byebug", "~> 3.9.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagalicious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Howe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-08 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.0
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.0
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday-rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: json-schema
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "~>"
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 2.8.1
47
+ version: '0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "~>"
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 2.8.1
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: oj
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +72,14 @@ dependencies:
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 3.10.0
75
+ version: '3'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 3.10.0
82
+ version: '3'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: factory_bot
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +126,7 @@ description: This gem is almost a straight copy and paste of https://github.com/
112
126
  with the Rails specific code stripped out so it can be used in Rack applications
113
127
  that don't use Rails.
114
128
  email:
115
- - eugene@xtreme-computers.net
129
+ - eugene.howe@protonmail.com
116
130
  executables: []
117
131
  extensions: []
118
132
  extra_rdoc_files: []
@@ -146,7 +160,7 @@ metadata:
146
160
  allowed_push_host: https://rubygems.org
147
161
  homepage_uri: https://github.com/ehowe/swagalicious
148
162
  source_code_uri: https://github.com/ehowe/swagalicious
149
- post_install_message:
163
+ post_install_message:
150
164
  rdoc_options: []
151
165
  require_paths:
152
166
  - lib
@@ -161,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
175
  - !ruby/object:Gem::Version
162
176
  version: '0'
163
177
  requirements: []
164
- rubygems_version: 3.0.8
165
- signing_key:
178
+ rubygems_version: 3.3.7
179
+ signing_key:
166
180
  specification_version: 4
167
181
  summary: RSwag without Rails
168
182
  test_files: []