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