rpdoc 0.1.2 → 0.1.6

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: 713fb6351f7a74091e6e88a197875d863f7df857710b0aa23d0210b588bb2052
4
- data.tar.gz: a8c3ddb59c58133f1b36c0cc8a7c743a538ff485488aba1f6d7063483a3bef3a
3
+ metadata.gz: caba52d54294faa94238dc9788932f4220a8aca303edd1168ac50e6525bd4648
4
+ data.tar.gz: 40377c908e39e6eef198030ad51d33475d2c7d7360ea68491cb8d383eb8eeb3c
5
5
  SHA512:
6
- metadata.gz: 7a62f5718f6ae2ef1d2ffc8f6f02126a2c827d5cc57de70f6bc7718d1e120a0c273f0329944fa88748c1acc0a4083ef5c1cccf3ad8b26c3fc407e04007fb0dfa
7
- data.tar.gz: b556c139e50d4934de146c8209dde5e6071889b5fb101af0c5d3a4a59c4e42b67d8bbbfc0d49f7f989fc7466336e0a7e16b59b1cdb345894a82750aea8a4bafe
6
+ metadata.gz: 9dc7e20fdd92637027e1023b5fdaf3426456fcf7fc76038c694421d610f45bc28399c135a1d7f88baf209ae9fbffbb95c9f352300f230940730c93ee96e6ef9c
7
+ data.tar.gz: 0a7c973ed4df9555bb348d5c7a6a513d834c6e8c4f8fdfc8862d24302e83db70c44f2d78398d8bf4d8ed7acea9f4ad77c490a439289a4f17548981199dfda01c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.1.6] - 2022-02-14
2
+ - Update licnese
3
+
4
+ ## [0.1.4, 0.1.5] - 2021-12-22
5
+ - Fix rspec parsing bugs
6
+
7
+ ## [0.1.3] - 2021-11-09
8
+ - Add require 'rspec/rails' if RSpec::Rails exists
9
+
1
10
  ## [0.1.2] - 2021-11-04
2
11
  - Add gem description
3
12
  - Remove unecessary gem dependency
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 yuntai
3
+ Copyright (c) 2021 Kdan Mobile Software Ltd
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  Add `rpdoc` to your application's `Gemfile`:
13
13
 
14
14
  ```ruby
15
- gem 'rpdoc', '~> 0.1.2'
15
+ gem 'rpdoc'
16
16
  ```
17
17
 
18
18
  And then install the gem:
data/VERSION.md CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.6
data/lib/rpdoc/helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'rspec/rails' if defined?(RSpec::Rails)
2
3
 
3
4
  RSpec.configure do |config|
4
5
  config.before(:suite) do
@@ -40,10 +40,6 @@ module Rpdoc
40
40
 
41
41
  private
42
42
 
43
- def collection_data
44
- @collection_data ||= @original_collection.present? ? @original_collection.deeper_merge(collection_from_rspec, merge_hash_arrays: true) : collection_from_rspec
45
- end
46
-
47
43
  def generated_collection_data
48
44
  {
49
45
  collection: {
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi'
4
+
3
5
  module Rpdoc
4
6
  class PostmanResponse
5
7
  attr_reader :data
@@ -38,15 +40,20 @@ module Rpdoc
38
40
  def response_data
39
41
  headers = @rspec_response.header.map { |key, value| {key: key, value: value} }
40
42
  headers << rspec_location_header
41
- {
43
+ data = {
42
44
  name: @rspec_example.metadata[:rpdoc_example_name],
43
45
  originalRequest: original_request_data,
44
46
  status: @rspec_response.status.to_s,
45
47
  code: @rspec_response.code.to_i,
46
48
  _postman_previewlanguage: "json",
47
49
  header: headers,
48
- body: JSON.pretty_generate(JSON.parse(@rspec_response.body))
49
50
  }
51
+ if @rspec_response.headers['Content-Type'].include?('application/json')
52
+ data[:body] = JSON.pretty_generate(JSON.parse(@rspec_response.body)) rescue nil
53
+ else
54
+ data[:body] = @rspec_response.body
55
+ end
56
+ data
50
57
  end
51
58
 
52
59
  def rspec_location_header
@@ -65,6 +72,14 @@ module Rpdoc
65
72
  value: @rspec_request.headers[header]
66
73
  }
67
74
  end.compact
75
+ query_string = @rspec_request.query_string.split('&').map do |string|
76
+ key, value = string.split('=')
77
+ {
78
+ key: key,
79
+ value: CGI.unescape(value),
80
+ text: 'text'
81
+ }
82
+ end
68
83
  @original_request_data = {
69
84
  method: @rspec_request.method,
70
85
  header: filter_headers,
@@ -72,7 +87,7 @@ module Rpdoc
72
87
  raw: "#{@configuration.rspec_server_host}#{@rspec_request.path}",
73
88
  host: [@configuration.rspec_server_host],
74
89
  path: @rspec_request.path.split('/'),
75
- variable: [],
90
+ query: query_string
76
91
  },
77
92
  body: nil
78
93
  }
@@ -0,0 +1,8 @@
1
+ namespace :rpdoc do
2
+ desc 'push collection to the Postman server'
3
+ task :push => :environment do
4
+ postman_collection = Rpdoc::PostmanCollection.new
5
+ postman_collection.save
6
+ postman_collection.send(Rpdoc.configuration.rpdoc_auto_push_strategy) if Rpdoc.configuration.rpdoc_auto_push
7
+ end
8
+ end
data/lib/rpdoc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rpdoc
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuntai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_requester
@@ -94,7 +94,7 @@ files:
94
94
  - CHANGELOG.md
95
95
  - Gemfile
96
96
  - Gemfile.lock
97
- - LICENSE.txt
97
+ - LICENSE
98
98
  - README.md
99
99
  - Rakefile
100
100
  - VERSION.md
@@ -107,6 +107,7 @@ files:
107
107
  - lib/rpdoc/helper.rb
108
108
  - lib/rpdoc/postman_collection.rb
109
109
  - lib/rpdoc/postman_response.rb
110
+ - lib/rpdoc/rpdoc.rake
110
111
  - lib/rpdoc/version.rb
111
112
  - rpdoc.gemspec
112
113
  homepage: https://github.com/kdan-mobile-software-ltd/rpdoc