webvalve 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/lib/webvalve/manager.rb +12 -0
- data/lib/webvalve/version.rb +1 -1
- data/spec/webvalve/manager_spec.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d632e36adb6db315896d3a144d02408dfcacdb7af5196874f4839d12b187499b
|
4
|
+
data.tar.gz: 044a117bf8a6df2eba482f99b5234e39b393f906ef0b895b3819d76805e76e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c5ca72aa5ac1ee8417a15df0848f66f019655a4870152c32ff62231b1df91eef435524f072e548e4091e509be76d2ac5fd19391ecafd861193c2ef1b92617e
|
7
|
+
data.tar.gz: b1a9d0d174ae5d65ca02fc62ecdb13b24f74489d13c6ab39995868cac56665015667632849a62477c087fc6fe4d0770d5945131ffd84914d61706e58e58b374e
|
data/CHANGELOG.md
CHANGED
@@ -9,7 +9,12 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
|
|
9
9
|
### Added
|
10
10
|
### Removed
|
11
11
|
|
12
|
-
## [0.
|
12
|
+
## [0.12.0] - 2020-02-22
|
13
|
+
### Changed
|
14
|
+
- raise an error on setup when multiple services are registered to the
|
15
|
+
same url. (https://github.com/Betterment/webvalve/pull/40)
|
16
|
+
|
17
|
+
## [0.11.0] - 2019-11-04
|
13
18
|
### Changed
|
14
19
|
- rework configuration so that WebValve has 3 operating modes: off,
|
15
20
|
on+allowing, and on+intercepting. support toggling the latter two
|
@@ -47,7 +52,9 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
|
|
47
52
|
### Changed
|
48
53
|
- WebMock 3+ support from @messanjah (https://github.com/Betterment/webvalve/pull/22)
|
49
54
|
|
50
|
-
[Unreleased]: https://github.com/Betterment/webvalve/compare/v0.
|
55
|
+
[Unreleased]: https://github.com/Betterment/webvalve/compare/v0.12.0...HEAD
|
56
|
+
[0.12.0]: https://github.com/Betterment/webvalve/compare/v0.11.0...v0.12.0
|
57
|
+
[0.11.0]: https://github.com/Betterment/webvalve/compare/v0.10.0...v0.11.0
|
51
58
|
[0.10.0]: https://github.com/Betterment/webvalve/compare/v0.9.10...v0.10.0
|
52
59
|
[0.9.10]: https://github.com/Betterment/webvalve/compare/v0.9.9...v0.9.10
|
53
60
|
[0.9.9]: https://github.com/Betterment/webvalve/compare/v0.9.8...v0.9.9
|
data/lib/webvalve/manager.rb
CHANGED
@@ -69,6 +69,7 @@ module WebValve
|
|
69
69
|
def reset
|
70
70
|
allowlisted_urls.clear
|
71
71
|
fake_service_configs.clear
|
72
|
+
stubbed_urls.clear
|
72
73
|
end
|
73
74
|
|
74
75
|
# @api private
|
@@ -126,6 +127,8 @@ module WebValve
|
|
126
127
|
end
|
127
128
|
|
128
129
|
def webmock_service(config)
|
130
|
+
ensure_non_duplicate_stub(config)
|
131
|
+
|
129
132
|
WebMock.stub_request(
|
130
133
|
:any,
|
131
134
|
url_to_regexp(config.service_url)
|
@@ -139,5 +142,14 @@ module WebValve
|
|
139
142
|
def url_to_regexp(url)
|
140
143
|
%r(\A#{Regexp.escape url})
|
141
144
|
end
|
145
|
+
|
146
|
+
def ensure_non_duplicate_stub(config)
|
147
|
+
raise "Invalid config for #{config.service_class_name}. Already stubbed url #{config.service_url}" if stubbed_urls.include?(config.service_url)
|
148
|
+
stubbed_urls << config.service_url
|
149
|
+
end
|
150
|
+
|
151
|
+
def stubbed_urls
|
152
|
+
@stubbed_urls ||= Set.new
|
153
|
+
end
|
142
154
|
end
|
143
155
|
end
|
data/lib/webvalve/version.rb
CHANGED
@@ -129,6 +129,18 @@ RSpec.describe WebValve::Manager do
|
|
129
129
|
|
130
130
|
expect(subject.allowlisted_urls).to include 'http://something.dev'
|
131
131
|
end
|
132
|
+
|
133
|
+
it 'raises with duplicate stubbed urls' do
|
134
|
+
disabled_service = class_double(WebValve::FakeService, name: 'FakeSomething')
|
135
|
+
other_disabled_service = class_double(WebValve::FakeService, name: 'FakeOtherThing')
|
136
|
+
|
137
|
+
with_env 'SOMETHING_API_URL' => 'http://something.dev', 'OTHER_THING_API_URL' => 'http://something.dev' do
|
138
|
+
subject.register disabled_service.name
|
139
|
+
subject.register other_disabled_service.name
|
140
|
+
|
141
|
+
expect { subject.setup }.to raise_error('Invalid config for FakeOtherThing. Already stubbed url http://something.dev')
|
142
|
+
end
|
143
|
+
end
|
132
144
|
end
|
133
145
|
|
134
146
|
context 'when WebValve is on and allowing traffic' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webvalve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
|
-
rubygems_version: 3.
|
225
|
+
rubygems_version: 3.1.2
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: A library for faking http service integrations in development and test
|