mock5 1.0.6 → 1.0.7

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: f46073471999d56560318ffd53aae8d68b24af17
4
- data.tar.gz: 9cc7ed0b830b9a56ad02f465cd1c4402b74bd3f3
3
+ metadata.gz: 302684b3737df5efb208d19be1208d91dfeebfb8
4
+ data.tar.gz: ab4838372d0d023ad51803d070ae85a32aea430c
5
5
  SHA512:
6
- metadata.gz: cdef01f636598d823789ed147073b681ff4b6facdb8f836a3126674258496ae4815ef2eb550362e957a6743f9897aa57c11df2457e928066fb2da8d26c618c04
7
- data.tar.gz: fc34feb90c6933d86ff0b7f82a1db399b53bd412d5d13954115c00b15672d6db1db36c974ca3bc0b4f33ef90692582a4ec5c21a67f338f1f84e0d158a2eb97b7
6
+ metadata.gz: 687c4d8be9ba1b200dcefd69707d04ad9f093949cfe77a69a6f33eede771e3eb980b2c708ceebf3835fd9995bddb55c6573f1e439919f8c3789804ea04eb810f
7
+ data.tar.gz: 1e259f624db169f4034c08a650f44e485307179a107f989ca9eaae01e305de398231e73d3d0b45fd75d8b745dd8ea0f722eb70c30e4a1b1069a3b88a21e34ddd
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .ruby-*
data/Gemfile CHANGED
@@ -4,6 +4,6 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  gem "bundler", "~> 1.6"
7
- gem "rspec", "~> 3.0"
7
+ gem "rspec", "~> 3.1"
8
8
  gem "rake", "~> 10.3"
9
9
  gem "pry"
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 posy body"},
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.remove_request_stub api.request_stub
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
@@ -1,3 +1,3 @@
1
1
  module Mock5
2
- VERSION = "1.0.6".freeze
2
+ VERSION = "1.0.7".freeze
3
3
  end
data/mock5.gemspec CHANGED
@@ -1,7 +1,5 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "mock5/version"
2
+ require_relative "lib/mock5/version"
5
3
 
6
4
  Gem::Specification.new do |spec|
7
5
  spec.name = "mock5"
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
- before{ described_class.mount api, another_api }
184
+ context "#mount" do
185
+ before{ described_class.mount api, another_api }
186
186
 
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")
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.6
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: 2014-10-18 00:00:00.000000000 Z
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.2.2
80
+ rubygems_version: 2.4.6
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Mock APIs using Sinatra