Module: Nonnative::Cucumber::ProxySteps
- Included in:
- Registration
- Defined in:
- lib/nonnative/cucumber.rb
Constant Summary collapse
- PROXY_OPERATIONS =
{ 'close_all' => :close_all, 'delay' => :delay, 'timeout' => :timeout, 'invalid_data' => :invalid_data, '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
83 84 85 86 87 88 89 |
# File 'lib/nonnative/cucumber.rb', line 83 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
69 70 71 72 73 74 |
# File 'lib/nonnative/cucumber.rb', line 69 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
76 77 78 79 80 81 |
# File 'lib/nonnative/cucumber.rb', line 76 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
64 65 66 67 |
# File 'lib/nonnative/cucumber.rb', line 64 def install_proxy_steps install_proxy_mutation_steps install_proxy_reset_steps end |