watchdocs-rails 0.7.0 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d1845d7f31d111819223a47123e0e1faf07bfb8
4
- data.tar.gz: b39fc2397b69a677627adaf348c23146f555e1e9
3
+ metadata.gz: 763ed25c75061c89d99d0fd622203e2d0cd4e786
4
+ data.tar.gz: e1c78747808662500ef28c3c9fc1fba548c4ed40
5
5
  SHA512:
6
- metadata.gz: ee89cfdf079de10cfb05cc5d9812c992fe0aba7f741c7f233b2adcb92bd50b3bb601bc0c00e5f3a88cdefa315ef2bc09f8b15bda0448c1293c33f17b9ab0d657
7
- data.tar.gz: d54d105671e5479961455a3154508c3129780a15f1f3618003a7f3155b045181996f0afe38d19d6fe54c90e599db232cd5eb8923ab0497d4c6a1a70567f1b78f
6
+ metadata.gz: 72b8a06c30bfe1e08806801dd8c2c6a06debe06729ac8d0d79803832be60165b992531726700700a343b0c25ce544edf45b03192bc74b499b25cc18adc2db39c
7
+ data.tar.gz: e49db39450ed37594a920edddbc91240d72a50d9340cb94f5968b856b0f796c45b11d62996b17e0f578d6e91af63218de18a80d2b5531d1294b6b54f09caa018
data/README.md CHANGED
@@ -103,6 +103,18 @@ Minitest.after_run do
103
103
  end
104
104
  ```
105
105
 
106
+ #### Configuring with WebMock
107
+
108
+
109
+ If you are using WebMock and it complains about real HTTP call please disable it for when exporting data to our API.
110
+
111
+ config.after(:suite) do
112
+ ....
113
+ WebMock.disable!
114
+ Watchdocs::Rails::Recordings.export
115
+ WebMock.enable!
116
+ end
117
+
106
118
  #### Configuring with VCR
107
119
 
108
120
 
@@ -1,3 +1,2 @@
1
- require 'watchdocs/rails/helpers/headers_helper'
2
1
  require 'watchdocs/rails/helpers/body_helper'
3
2
  require 'watchdocs/rails/helpers/query_string_helper'
@@ -1,7 +1,6 @@
1
1
  module Watchdocs
2
2
  module Rails
3
3
  class Middleware
4
- include Rails::Helpers::HeadersHelper
5
4
  include Rails::Helpers::BodyHelper
6
5
  include Rails::Helpers::QueryStringHelper
7
6
 
@@ -44,8 +43,7 @@ module Watchdocs
44
43
  method: env['REQUEST_METHOD'],
45
44
  url: env['PATH_INFO'],
46
45
  query_string_params: parse_query_string(env['QUERY_STRING']),
47
- body: parse_request_body(env['rack.input'].read),
48
- headers: request_headers(env)
46
+ body: parse_request_body(env['rack.input'].read)
49
47
  }
50
48
  end
51
49
 
@@ -53,7 +51,6 @@ module Watchdocs
53
51
  status, headers, body = *response
54
52
  @report[:response] = {
55
53
  status: status,
56
- headers: headers.to_hash.upcased_keys,
57
54
  body: parse_response_body(body_string(body))
58
55
  }
59
56
  end
@@ -16,13 +16,20 @@ module Watchdocs
16
16
  def clear!(from_specs: true)
17
17
  set_store(from_specs)
18
18
  clear_recordings
19
+ rescue StandardError => e
20
+ $stderr.puts "Watchdocs Error: #{e.message}.
21
+ Please report it to contact@watchdocs.io"
19
22
  end
20
23
 
21
24
  def export(recordings = nil, from_specs: true)
22
25
  set_store(from_specs)
23
26
  recordings ||= current_recordings
27
+ return unless current_recordings
24
28
  export_recorings(recordings) && clear!(from_specs: from_specs)
25
29
  $stderr.puts "Watchdocs: #{recordings.count} requests exported"
30
+ rescue StandardError => e
31
+ $stderr.puts "Watchdocs Error: #{e.message}.
32
+ Please report it to contact@watchdocs.io"
26
33
  end
27
34
 
28
35
  private
@@ -1,5 +1,5 @@
1
1
  module Watchdocs
2
2
  module Rails
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
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.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mazikwyry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-24 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -143,7 +143,6 @@ files:
143
143
  - lib/watchdocs/rails/core_extensions/object.rb
144
144
  - lib/watchdocs/rails/helpers.rb
145
145
  - lib/watchdocs/rails/helpers/body_helper.rb
146
- - lib/watchdocs/rails/helpers/headers_helper.rb
147
146
  - lib/watchdocs/rails/helpers/query_string_helper.rb
148
147
  - lib/watchdocs/rails/middleware.rb
149
148
  - lib/watchdocs/rails/recordings.rb
@@ -1,19 +0,0 @@
1
- module Watchdocs
2
- module Rails
3
- module Helpers
4
- module HeadersHelper
5
- def request_headers(env)
6
- env.keys
7
- .select { |k| k.start_with? 'HTTP_' }
8
- .map { |k| format_header(k) }
9
- .sort
10
- end
11
-
12
- def format_header(header)
13
- header.sub(/^HTTP_/, '')
14
- .tr('_', '-')
15
- end
16
- end
17
- end
18
- end
19
- end