fake_http 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/fake_http.rb +23 -3
- data/lib/fake_http/identity.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d0e55ac0c96723a2d777bbde96d24d9a01738cf
|
4
|
+
data.tar.gz: 79defab86ee1abc93ec3139862896dfc6d2e4225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42ee0aee82cf8d4a8954462b2687ffd5d41ebf874a2352c16c51ea966788d531a6d2372786119457023f6741fff4d0acdc921fea19ca4d400ab7e650a0d0c27d
|
7
|
+
data.tar.gz: 117fee2cc88dac4fa597c836fbe7faca2004a2b96d1229db1d2a3e78e7047f157b1192b3cf18347d235f24603cc07f4d35a1a61840aa5b8da12e2da6980a5bf6
|
data/README.md
CHANGED
data/lib/fake_http.rb
CHANGED
@@ -39,15 +39,35 @@ class FakeHTTP
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def get(pattern, &block)
|
42
|
-
|
43
|
-
|
42
|
+
add_responder(:get, pattern, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def post(pattern, &block)
|
46
|
+
add_responder(:post, pattern, &block)
|
47
|
+
end
|
48
|
+
|
49
|
+
def put(pattern, &block)
|
50
|
+
add_responder(:put, pattern, &block)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete(pattern, &block)
|
54
|
+
add_responder(:delete, pattern, &block)
|
44
55
|
end
|
45
56
|
|
46
57
|
def request(verb, uri, options = {})
|
47
|
-
|
58
|
+
path = URI.parse(uri).path
|
59
|
+
responder = @fakes[verb].detect { |responder| responder.match(path) }
|
60
|
+
raise "No responder defined for #{verb} #{uri}" unless responder
|
48
61
|
responder.call(uri, options)
|
49
62
|
end
|
50
63
|
|
64
|
+
private
|
65
|
+
|
66
|
+
def add_responder(verb, pattern, &block)
|
67
|
+
responder = Responder.new(pattern, block)
|
68
|
+
@fakes[verb] << responder
|
69
|
+
end
|
70
|
+
|
51
71
|
end
|
52
72
|
|
53
73
|
require "mustermann"
|
data/lib/fake_http/identity.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Sadauskas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mustermann
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '10.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '10.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
199
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.6.
|
200
|
+
rubygems_version: 2.6.11
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: ''
|