mock5 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/lib/mock5.rb +4 -2
- data/lib/mock5/version.rb +1 -1
- data/mock5.gemspec +1 -3
- data/spec/mock5_spec.rb +21 -7
- 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: 302684b3737df5efb208d19be1208d91dfeebfb8
|
4
|
+
data.tar.gz: ab4838372d0d023ad51803d070ae85a32aea430c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 687c4d8be9ba1b200dcefd69707d04ad9f093949cfe77a69a6f33eede771e3eb980b2c708ceebf3835fd9995bddb55c6573f1e439919f8c3789804ea04eb810f
|
7
|
+
data.tar.gz: 1e259f624db169f4034c08a650f44e485307179a107f989ca9eaae01e305de398231e73d3d0b45fd75d8b745dd8ea0f722eb70c30e4a1b1069a3b88a21e34ddd
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/lib/mock5.rb
CHANGED
@@ -21,7 +21,7 @@ module Mock5
|
|
21
21
|
# my_mock_api = Mock5.mock("http://example.com") do
|
22
22
|
# get "posts" do
|
23
23
|
# [
|
24
|
-
# {id: 1, body: "a
|
24
|
+
# {id: 1, body: "a post body"},
|
25
25
|
# {id: 2, body: "another post body"}
|
26
26
|
# ].to_json
|
27
27
|
# end
|
@@ -66,7 +66,9 @@ module Mock5
|
|
66
66
|
def unmount(*apis)
|
67
67
|
mounted_apis.intersection(apis).each do |api|
|
68
68
|
mounted_apis.delete api
|
69
|
-
registry.
|
69
|
+
if registry.request_stubs.include?(api.request_stub)
|
70
|
+
registry.remove_request_stub api.request_stub
|
71
|
+
end
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
data/lib/mock5/version.rb
CHANGED
data/mock5.gemspec
CHANGED
data/spec/mock5_spec.rb
CHANGED
@@ -16,7 +16,6 @@ describe Mock5 do
|
|
16
16
|
|
17
17
|
describe "API mgmt" do
|
18
18
|
before do
|
19
|
-
WebMock::StubRegistry.instance.reset!
|
20
19
|
described_class.instance_exec do
|
21
20
|
if instance_variable_defined?(:@_mounted_apis)
|
22
21
|
remove_instance_variable :@_mounted_apis
|
@@ -182,13 +181,28 @@ describe Mock5 do
|
|
182
181
|
end
|
183
182
|
end
|
184
183
|
|
185
|
-
|
184
|
+
context "#mount" do
|
185
|
+
before{ described_class.mount api, another_api }
|
186
186
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
187
|
+
it "stubs remote apis" do
|
188
|
+
expect(get("http://example.com/index.html?foo=bar")).to eq("index.html")
|
189
|
+
expect(post("http://example.com/submit/here?foo=bar")).to eq("submit")
|
190
|
+
expect(post("http://example.com/foo/bar?fizz=buzz")).to eq("bar")
|
191
|
+
expect(get("http://example.com/bar/foo")).to eq("foo")
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
context "#with_mounted" do
|
196
|
+
around do |example|
|
197
|
+
described_class.with_mounted api, another_api, &example
|
198
|
+
end
|
199
|
+
|
200
|
+
it "stubs remote apis" do
|
201
|
+
expect(get("http://example.com/index.html?foo=bar")).to eq("index.html")
|
202
|
+
expect(post("http://example.com/submit/here?foo=bar")).to eq("submit")
|
203
|
+
expect(post("http://example.com/foo/bar?fizz=buzz")).to eq("bar")
|
204
|
+
expect(get("http://example.com/bar/foo")).to eq("foo")
|
205
|
+
end
|
192
206
|
end
|
193
207
|
end
|
194
208
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pravosud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webmock
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.4.6
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Mock APIs using Sinatra
|