Module: RSMP::Validator::Helpers::SignalPlans

Defined in:
lib/rsmp/validator/helpers/signal_plans.rb

Overview

Helper methods for testing RSMP signal plan functionality.

Instance Method Summary collapse

Instance Method Details

#with_cycle_time_extended(site_proxy, extension = 5, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rsmp/validator/helpers/signal_plans.rb', line 6

def with_cycle_time_extended(site_proxy, extension = 5, &block)
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
  plan = site_proxy.tlc.read_current_plan
  time = read_plan_cycle_time(site_proxy, plan)
  need_to_reset = true
  time_extended = time + extension
  site_proxy.tlc.set_cycle_time(plan: plan, cycle_time: time_extended, within: timeout)
  verify_cycle_time(site_proxy, plan, time_extended)
  block.yield
ensure
  if need_to_reset
    log 'Reset cycle time'
    site_proxy.tlc.set_cycle_time(plan: plan, cycle_time: time, within: timeout)
  end
end