Module: RSpec::OpenHAB::Helpers

Defined in:
lib/rspec/openhab/helpers.rb

Instance Method Summary collapse

Instance Method Details

#autoupdate_all_itemsObject



6
7
8
9
10
11
# File 'lib/rspec/openhab/helpers.rb', line 6

def autoupdate_all_items
  @autoupdated_items ||= {}
  $ir.for_each do |_provider, item|
    @autoupdated_items[item] = item.meta.delete("autoupdate") if item.meta.key?("autoupdate")
  end
end

#execute_timersObject



13
14
15
# File 'lib/rspec/openhab/helpers.rb', line 13

def execute_timers
  ::OpenHAB::DSL::Timers.timer_manager.execute_timers
end

#suspend_rules(&block) ⇒ Object



17
18
19
# File 'lib/rspec/openhab/helpers.rb', line 17

def suspend_rules(&block)
  SuspendRules.suspend_rules(&block)
end

#trigger_rule(rule_name, event = nil) ⇒ Object



21
22
23
24
25
# File 'lib/rspec/openhab/helpers.rb', line 21

def trigger_rule(rule_name, event = nil)
  @rules ||= ::OpenHAB::DSL::Rules::Rule.script_rules.each_with_object({}) { |r, obj| obj[r.name] = r }

  @rules.fetch(rule_name).execute(nil, { "event" => event })
end