watchdocs-rails 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/watchdocs/rails/middleware.rb +11 -5
- data/lib/watchdocs/rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4415114e6bf241747b8bb6afac17487ade6b9a0
|
|
4
|
+
data.tar.gz: 0f29409caa9cff8815529710a29bddeba253a7f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3bb1825c10f663f6828c88e29faa1b695725ab9f22c6908be8a05d48cb667b875db2e6a0358f514f0c2ebec5340c7738c97edbf9b3d46c85b64b23904ea7a8b
|
|
7
|
+
data.tar.gz: 7e48c82c3b46fe0ea5b123429a83c4f76fbfdbe2ae0a1586f6cc94a81541f6f2a374f5ddfbd0588f1b978ba92c819724df034d6de3252324e52e74111ee534f0
|
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ bundle
|
|
|
20
20
|
|
|
21
21
|
and then fire the installation script
|
|
22
22
|
|
|
23
|
-
```
|
|
23
|
+
```ruby
|
|
24
24
|
rails g watchdocs:install --app_id your_app_id --app_secret your_app_secret
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -118,12 +118,14 @@ end
|
|
|
118
118
|
|
|
119
119
|
If you are using WebMock and it complains about real HTTP call please disable it for when exporting data to our API.
|
|
120
120
|
|
|
121
|
+
```ruby
|
|
121
122
|
config.after(:suite) do
|
|
122
123
|
....
|
|
123
124
|
WebMock.disable!
|
|
124
125
|
Watchdocs::Rails::Recordings.export
|
|
125
126
|
WebMock.enable!
|
|
126
127
|
end
|
|
128
|
+
```
|
|
127
129
|
|
|
128
130
|
#### Configuring with VCR
|
|
129
131
|
|
|
@@ -14,7 +14,7 @@ module Watchdocs
|
|
|
14
14
|
def call(env)
|
|
15
15
|
app.call(env).tap do |response|
|
|
16
16
|
begin
|
|
17
|
-
if
|
|
17
|
+
if record_response?(response)
|
|
18
18
|
clear_report
|
|
19
19
|
catch_request(env)
|
|
20
20
|
catch_response(response)
|
|
@@ -29,8 +29,16 @@ module Watchdocs
|
|
|
29
29
|
|
|
30
30
|
private
|
|
31
31
|
|
|
32
|
-
def
|
|
33
|
-
headers = response
|
|
32
|
+
def record_response?(response)
|
|
33
|
+
status, headers, _body = *response
|
|
34
|
+
no_content_response?(status) || json_response?(headers)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def no_content_response?(status)
|
|
38
|
+
status.to_i == 204
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def json_response?(headers)
|
|
34
42
|
headers['Content-Type'] && headers['Content-Type'].include?('json')
|
|
35
43
|
end
|
|
36
44
|
|
|
@@ -61,8 +69,6 @@ module Watchdocs
|
|
|
61
69
|
.simulator.memos(report[:request][:url])
|
|
62
70
|
.last.path.spec.to_s.sub('(.:format)', '')
|
|
63
71
|
end
|
|
64
|
-
rescue
|
|
65
|
-
@report[:endpoint] = 'No routes match'
|
|
66
72
|
end
|
|
67
73
|
|
|
68
74
|
def record_call
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: watchdocs-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mazikwyry
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-06-
|
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
187
187
|
version: '0'
|
|
188
188
|
requirements: []
|
|
189
189
|
rubyforge_project:
|
|
190
|
-
rubygems_version: 2.
|
|
190
|
+
rubygems_version: 2.6.10
|
|
191
191
|
signing_key:
|
|
192
192
|
specification_version: 4
|
|
193
193
|
summary: Rails Rack-Middleware for capturing JSON requests and responses details
|