Class: WebValve::Manager Private
- Inherits:
-
Object
- Object
- WebValve::Manager
- Includes:
- Singleton
- Defined in:
- lib/webvalve/manager.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #fake_service_configs ⇒ Object private
- #register(fake_service, **args) ⇒ Object private
- #reset ⇒ Object private
- #setup ⇒ Object private
- #whitelist_url(url) ⇒ Object private
- #whitelisted_urls ⇒ Object private
Instance Method Details
#fake_service_configs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/webvalve/manager.rb', line 40 def fake_service_configs @fake_service_configs ||= [] end |
#register(fake_service, **args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 13 |
# File 'lib/webvalve/manager.rb', line 10 def register(fake_service, **args) raise "#{fake_service.inspect} already registered" if fake_service_configs.any? { |c| c.service == fake_service } fake_service_configs << FakeServiceConfig.new(service: fake_service, **args) end |
#reset ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 |
# File 'lib/webvalve/manager.rb', line 34 def reset whitelisted_urls.clear fake_service_configs.clear end |
#setup ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/webvalve/manager.rb', line 20 def setup fake_service_configs.each do |config| if config.should_intercept? webmock_service config else whitelist_service config end end WebMock.enable! WebMock.disable_net_connect! end |
#whitelist_url(url) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 |
# File 'lib/webvalve/manager.rb', line 15 def whitelist_url(url) raise "#{url} already registered" if whitelisted_urls.include?(url) whitelisted_urls << url end |
#whitelisted_urls ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/webvalve/manager.rb', line 45 def whitelisted_urls @whitelisted_urls ||= Set.new end |