swagalicious 0.4.6 → 0.4.9

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: 2039bd3f0c7d96f3b0793d3d2688acae7c450815a8943532187b218f3d7d7939
4
- data.tar.gz: 18ee9a8aa325795e4b75f221c70f0ccf7195007872f9c4366db56f98c471905d
3
+ metadata.gz: 0c8a067a1f9513407e71eb9fc8b0417a7ee1902b0a57f64fc6f8350d19547120
4
+ data.tar.gz: ae6daf40f2d7d2103cd7f02ab681ac668aad4a17dd62ff91116ada20d1efa8e2
5
5
  SHA512:
6
- metadata.gz: 21cf90ba1dc63fef0fcf37182fba4ab92938878f2e66442369a880c10624a59f1344a72297b9b94b28cde9e3fddf0dc1874ddef57e17ddc40d365b962547eb9d
7
- data.tar.gz: f5c66b99a2cd90e607daa22f93995e37a1019e9b28620c56d2b8348221c94a545a3ac54167e35062e81122b7bfdfadf4bfb43d53863a1d4ae7b578f869963554
6
+ metadata.gz: 4e56b57b18b5a810b75ea4ac18cab307fd0d57c713b4c6fb832d55870dcecc26bdf6ff6f521829a0dd5fe55fcd47f11582ca8f4aa4b483432b0bf4d7c6bb7c69
7
+ data.tar.gz: 153859f7e8a64f7b49f8c18776d2b86691ee29c83fb8e19113b4cd2fc00a08b3090ea07e386f6430d8328a541c5d513e3083ec51dcf6f89bebfbc79153558042
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swagalicious (0.4.5)
4
+ swagalicious (0.4.7)
5
5
  faraday (~> 2.0)
6
6
  faraday-rack
7
7
  json-schema
@@ -25,10 +25,10 @@ GEM
25
25
  diff-lcs (1.5.0)
26
26
  factory_bot (6.1.0)
27
27
  activesupport (>= 5.0.0)
28
- faraday (2.3.0)
28
+ faraday (2.4.0)
29
29
  faraday-net_http (~> 2.0)
30
30
  ruby2_keywords (>= 0.0.4)
31
- faraday-net_http (2.0.3)
31
+ faraday-net_http (2.1.0)
32
32
  faraday-rack (2.0.0)
33
33
  faraday (~> 2.0)
34
34
  i18n (1.10.0)
@@ -20,25 +20,27 @@ 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
27
27
  @client ||= Faraday.new do |b|
28
- b.adapter(:rack)
28
+ b.adapter Faraday::Adapter::Rack, app
29
29
  end
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
@@ -1,3 +1,3 @@
1
1
  class Swagalicious
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.9"
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
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "faraday", "~> 2.0"
28
28
  spec.add_dependency "faraday-rack"
29
29
  spec.add_dependency "json-schema"
30
- spec.add_dependency "oj", "~> 3.11.0"
30
+ spec.add_dependency "oj", "~> 3.11.0"
31
+ spec.add_dependency "rack-test", "~> 1.1.0"
31
32
  spec.add_dependency "rspec", "~> 3"
32
33
 
33
34
  spec.add_development_dependency "factory_bot", "~> 6.1.0"
34
35
  spec.add_development_dependency "pry-byebug", "~> 3.9.0"
35
- spec.add_development_dependency "rack-test", "~> 1.1.0"
36
36
  end
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.6
4
+ version: 0.4.9
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-21 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
@@ -67,61 +67,61 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.11.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: rack-test
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3'
75
+ version: 1.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3'
82
+ version: 1.1.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: factory_bot
84
+ name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 6.1.0
90
- type: :development
89
+ version: '3'
90
+ type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 6.1.0
96
+ version: '3'
97
97
  - !ruby/object:Gem::Dependency
98
- name: pry-byebug
98
+ name: factory_bot
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 3.9.0
103
+ version: 6.1.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 3.9.0
110
+ version: 6.1.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: rack-test
112
+ name: pry-byebug
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.0
117
+ version: 3.9.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.1.0
124
+ version: 3.9.0
125
125
  description: This gem is almost a straight copy and paste of https://github.com/rswag/rswag/tree/master/rswag-specs
126
126
  with the Rails specific code stripped out so it can be used in Rack applications
127
127
  that don't use Rails.
@@ -160,7 +160,7 @@ metadata:
160
160
  allowed_push_host: https://rubygems.org
161
161
  homepage_uri: https://github.com/ehowe/swagalicious
162
162
  source_code_uri: https://github.com/ehowe/swagalicious
163
- post_install_message:
163
+ post_install_message:
164
164
  rdoc_options: []
165
165
  require_paths:
166
166
  - lib
@@ -175,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.8
179
- signing_key:
178
+ rubygems_version: 3.3.7
179
+ signing_key:
180
180
  specification_version: 4
181
181
  summary: RSwag without Rails
182
182
  test_files: []