Module: Nonnative::Cucumber::ProxySteps
- Included in:
- Registration
- Defined in:
- lib/nonnative/cucumber.rb
Constant Summary collapse
- PROXY_OPERATIONS =
{ 'close_all' => :close_all, 'reset_peer' => :reset_peer, 'delay' => :delay, 'timeout' => :timeout, 'invalid_data' => :invalid_data, 'bandwidth' => :bandwidth, 'limit_data' => :limit_data, 'slicer' => :slicer, 'flaky' => :flaky, 'reset' => :reset }.freeze
Instance Method Summary collapse
- #apply_proxy_operation(proxy, operation) ⇒ Object
- #install_proxy_mutation_steps ⇒ Object
- #install_proxy_reset_steps ⇒ Object
- #install_proxy_steps ⇒ Object
Instance Method Details
#apply_proxy_operation(proxy, operation) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/nonnative/cucumber.rb', line 88 def apply_proxy_operation(proxy, operation) method = PROXY_OPERATIONS.fetch(operation) do raise ArgumentError, "Unsupported proxy operation '#{operation}'" end proxy.public_send(method) end |
#install_proxy_mutation_steps ⇒ Object
74 75 76 77 78 79 |
# File 'lib/nonnative/cucumber.rb', line 74 def install_proxy_mutation_steps Given('I set the proxy for service {string} to {string}') do |name, operation| service = Nonnative.pool.service_by_name(name) Nonnative::Cucumber::Registration.apply_proxy_operation(service.proxy, operation) end end |
#install_proxy_reset_steps ⇒ Object
81 82 83 84 85 86 |
# File 'lib/nonnative/cucumber.rb', line 81 def install_proxy_reset_steps Then('I should reset the proxy for service {string}') do |name| service = Nonnative.pool.service_by_name(name) service.proxy.reset end end |
#install_proxy_steps ⇒ Object
69 70 71 72 |
# File 'lib/nonnative/cucumber.rb', line 69 def install_proxy_steps install_proxy_mutation_steps install_proxy_reset_steps end |