rspec_api_docs 0.6.2 → 0.6.3

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
  SHA1:
3
- metadata.gz: dd8485abb26ef256dc69de246ca6a53402bc7f9a
4
- data.tar.gz: 5b3ccc48e2f171898e32ab8243e5318ff269b00f
3
+ metadata.gz: 63116ee00221ca9def40076d11bd15af14f8d6eb
4
+ data.tar.gz: be505206040db12af2821dc6538aaa3090d7f712
5
5
  SHA512:
6
- metadata.gz: 94568c774c4a71c6e4eb9013e60a4a81908c5e76844578f9b6d69c82574f687ae9392e25a35523e562677276387d32100c57baad04440a38ba03f172573834eb
7
- data.tar.gz: 2da73445d802f157e2fb8acff2790d31c33ad0e955797b5c8e9d1f2301f772c0715ec26f7b3bf9d4eafdb72a2d6622b69bb320c37bcefa12c9dde7cff313315a
6
+ metadata.gz: fbf680eb8b1a95e7a8d9c9ebe43792ab27ad95665d4c3ecb1f4cd5e34899c81942fdad8ae8835fd3ba84d05698bf18023d09fb5360a5befffab0d5a96ef2cba6
7
+ data.tar.gz: 4033b945fc522108743a89fb62ac082dea47e1ef415d418bc94c7c7dd8554a8f1d11aaeaaea3ab42ce16507e3e5551e55c192b16e44e2a9ebc9273f0790366be
@@ -5,8 +5,10 @@ require "rspec_api_docs/helper"
5
5
  RSpec.configure do |config|
6
6
  config.before(:suite) do
7
7
  next unless RspecApiDocs::Helper.running_api_specs?(config)
8
-
9
8
  file = RspecApiDocs::Helper.file
9
+
10
+ # Delete and re-create the file each time
11
+ File.delete(file) if File.exists?(file)
10
12
  File.new(file, "w+") unless File.exists?(file)
11
13
  end
12
14
 
@@ -17,21 +19,13 @@ RSpec.configure do |config|
17
19
  next unless request && request.try(:symbolized_path_parameters)
18
20
 
19
21
  if response
20
- example_group = example.metadata[:example_group]
21
- example_groups = []
22
-
23
- while example_group
24
- example_groups << example_group
25
- example_group = example_group[:example_group]
26
- end
27
-
28
22
  file_name = request.symbolized_path_parameters[:controller].gsub(/\//, '_').gsub('api_', '')
29
23
 
30
24
  id_symbol = request.symbolized_path_parameters.keys.find{|k| k.match /id/}
31
25
  optional_param = request.symbolized_path_parameters[id_symbol] ? "/{:#{id_symbol}}" : ""
32
26
  action = "#{request.request_method} #{request.symbolized_path_parameters[:controller]}#{optional_param}"
33
27
 
34
- file = RspecApiDocs::Dir.file
28
+ file = RspecApiDocs::Helper.file
35
29
 
36
30
  collection = action.match(/(POST|GET|PATCH|DELETE) (portal\/api|api)\/v\d*\/(.*)/)[3]
37
31
  version_and_collection = action.match(/(POST|GET|PATCH|DELETE) (portal\/api|api)(.*)/)[3]
@@ -62,8 +56,8 @@ RSpec.configure do |config|
62
56
  f.write "+ Request #{request.content_type}\n\n"
63
57
 
64
58
  # Request Body
65
- if request_body.present?# && request.content_type == 'application/json'
66
- f.write "+ Body\n\n".indent(4)# if authorization_header
59
+ if request_body.present?
60
+ f.write "+ Body\n\n".indent(4)
67
61
  f.write "#{JSON.pretty_generate(JSON.parse(JSON.pretty_generate(request_body)))}\n\n".indent(authorization_header ? 12 : 8)
68
62
  end
69
63
  end
@@ -1,3 +1,3 @@
1
1
  module RspecApiDocs
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_api_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Kadwill