rpdoc 0.1.3 → 0.1.7

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: 4f03cfd2f4d8be54605de03a2c0516cc3948183a93ea74f492df9a4759324bed
4
- data.tar.gz: c38f408b3d95a7317d4cf0ff3e82c0ec0de0ec62cb16e502058419f068070c55
3
+ metadata.gz: 204129b067a6bafd639a29a0a18f361526855a2472d252f7b2f5f08258c91ff3
4
+ data.tar.gz: bf9fac67e3ccdd67441bd39cee555ef34af168367adae4832be6beb7cad2065a
5
5
  SHA512:
6
- metadata.gz: ade5344d6a36274c2ec3837b083356a946e07dc3bde14d55dc837e79f83b42d607d0b349553eaaca80e0a2e198e5b8919c4f72d0a3229692c2c291b0f31b0af7
7
- data.tar.gz: 00f59e9bc5f197f2ca930c6f26ba1219e1a2d6c8eb503c430c00a17bb0cc102bcbc2992799eaed0a358c5c07ea6dd87328abddd57f340d0067cffbde8cd75f5f
6
+ metadata.gz: 1b362d3e068426fc9eb21cd367d3caca67c9838e55a060954f5633415fdf8cca5ed10ce70199ff2a51eab65ffa54c09b9b443dd70c610cdea75beb6dcc2c8d73
7
+ data.tar.gz: a7ae37b09463579a01da095527e84b0af7adc0470df89462b064c556673a278f7656409d3d18821e1b390dd87a79059c38f306b72062ac8f0e3620f7a3595a69
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.1.7] - 2022-02-14
2
+ - Fix rspec parse zip response bug
3
+ ## [0.1.6] - 2022-02-14
4
+ - Update licnese
5
+
6
+ ## [0.1.4, 0.1.5] - 2021-12-22
7
+ - Fix rspec parsing bugs
8
+
1
9
  ## [0.1.3] - 2021-11-09
2
10
  - Add require 'rspec/rails' if RSpec::Rails exists
3
11
 
@@ -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.3
1
+ 0.1.7
@@ -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,21 @@ 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
+ body = @rspec_response.body
55
+ data[:body] = body.encoding == 'ASCII-8BIT' ? body.force_encoding("ISO-8859-1").encode("UTF-8") : body
56
+ end
57
+ data
50
58
  end
51
59
 
52
60
  def rspec_location_header
@@ -65,6 +73,14 @@ module Rpdoc
65
73
  value: @rspec_request.headers[header]
66
74
  }
67
75
  end.compact
76
+ query_string = @rspec_request.query_string.split('&').map do |string|
77
+ key, value = string.split('=')
78
+ {
79
+ key: key,
80
+ value: CGI.unescape(value),
81
+ text: 'text'
82
+ }
83
+ end
68
84
  @original_request_data = {
69
85
  method: @rspec_request.method,
70
86
  header: filter_headers,
@@ -72,7 +88,7 @@ module Rpdoc
72
88
  raw: "#{@configuration.rspec_server_host}#{@rspec_request.path}",
73
89
  host: [@configuration.rspec_server_host],
74
90
  path: @rspec_request.path.split('/'),
75
- variable: [],
91
+ query: query_string
76
92
  },
77
93
  body: nil
78
94
  }
@@ -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.3"
4
+ VERSION = "0.1.7"
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.3
4
+ version: 0.1.7
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-09 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