webmockdump 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/lib/webmockdump.rb +32 -0
- data/webmockdump.gemspec +14 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: '03558c296d268fec3bb4758e6f1435e9f30151bc'
|
4
|
+
data.tar.gz: 8a8d4580e426721751125d75357f5813bf362b5a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a438cdb3e28ff67a352fd42ad69344bfe19fb2520f44d57e468e6322763cbd588dda398aba978d5d1226999e4deab62d32015c605870acce0125687ba1ed2c07
|
7
|
+
data.tar.gz: 5a707ed584cb7d0f9023e6c0567cd384248decd1d5bd478628b24e0fd0485c70f0b40179d7c8f66427a49d4f7f66ed09e24415ae52cc80059a8fb20afbc95af6
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Victor Maslov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/lib/webmockdump.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "webmock"
|
2
|
+
|
3
|
+
WebMock.enable_net_connect!
|
4
|
+
WebMock.enable!
|
5
|
+
|
6
|
+
# executes the request to make us know what to stub it with
|
7
|
+
WebMock.after_request real_requests_only: true do |req_signature, response|
|
8
|
+
# next unless WebMock.enabled?
|
9
|
+
puts "Request:\n#{req_signature}"
|
10
|
+
if response.body
|
11
|
+
dup = response.dup
|
12
|
+
File.write "body.txt", dup.body
|
13
|
+
dup.body = "<<< FILE: ./body.txt >>>"
|
14
|
+
puts "Response:\n#{dup.pretty_inspect}"
|
15
|
+
else
|
16
|
+
puts "Response:\n#{response.pretty_inspect}"
|
17
|
+
end
|
18
|
+
raise WebMock::NetConnectNotAllowedError.new req_signature
|
19
|
+
end
|
20
|
+
WebMock.module_eval do
|
21
|
+
define_method(:net_connect_allowed?){ |*| true }
|
22
|
+
end
|
23
|
+
|
24
|
+
# https://github.com/bblimke/webmock/issues/469#issuecomment-752411256
|
25
|
+
WebMock::HttpLibAdapters::NetHttpAdapter.instance_variable_get(:@webMockNetHTTP).class_eval do
|
26
|
+
old_request = instance_method :request
|
27
|
+
define_method :request do |request, &block|
|
28
|
+
old_request.bind(self).(request, &block).tap do |response|
|
29
|
+
response.uri = request.uri
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/webmockdump.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "webmockdump"
|
3
|
+
spec.version = "0.0.0"
|
4
|
+
spec.summary = "Patch for webmock that instead of halting is doing and dumping the request for easier mocks development."
|
5
|
+
|
6
|
+
spec.author = "Victor Maslov aka Nakilon"
|
7
|
+
spec.email = "nakilon@gmail.com"
|
8
|
+
spec.license = "MIT"
|
9
|
+
spec.metadata = {"source_code_uri" => "https://github.com/nakilon/webmockdump"}
|
10
|
+
|
11
|
+
spec.add_dependency "webmock"
|
12
|
+
|
13
|
+
spec.files = %w{ LICENSE webmockdump.gemspec lib/webmockdump.rb }
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webmockdump
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Maslov aka Nakilon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: webmock
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email: nakilon@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- LICENSE
|
34
|
+
- lib/webmockdump.rb
|
35
|
+
- webmockdump.gemspec
|
36
|
+
homepage:
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
metadata:
|
40
|
+
source_code_uri: https://github.com/nakilon/webmockdump
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.5.2.3
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Patch for webmock that instead of halting is doing and dumping the request
|
61
|
+
for easier mocks development.
|
62
|
+
test_files: []
|