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
61 62 63 64 65 66 67 |
# File 'lib/nonnative/cucumber.rb', line 61 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
47 48 49 50 51 52 |
# File 'lib/nonnative/cucumber.rb', line 47 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
54 55 56 57 58 59 |
# File 'lib/nonnative/cucumber.rb', line 54 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
42 43 44 45 |
# File 'lib/nonnative/cucumber.rb', line 42 def install_proxy_steps install_proxy_mutation_steps install_proxy_reset_steps end |