Skip to content

Commit

Permalink
use dscalarm binding for tests (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer authored Sep 18, 2024
1 parent d1a184c commit 996eb75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion rakelib/docs.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# frozen_string_literal: true

require "yard"
begin
require "yard"
rescue LoadError
return
end

namespace :docs do
yard_dir = File.join("docs", "yard")
Expand Down
6 changes: 3 additions & 3 deletions spec/openhab/core/things/thing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
end

it "returns true for bridges" do
install_addon "binding-mqtt", ready_markers: "openhab.xmlThingTypes"
things.build { bridge "mqtt:broker:mosquitto", "MQTT Broker" }
install_addon "binding-dscalarm", ready_markers: "openhab.xmlThingTypes"
things.build { bridge "dscalarm:tcpserver:panel", "Alarm Panel" }

expect(things["mqtt:broker:mosquitto"]).to be_bridge
expect(things["dscalarm:tcpserver:panel"]).to be_bridge
end
end
end
10 changes: 5 additions & 5 deletions spec/openhab/dsl/things/builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,22 +328,22 @@ def build_and_update(org_config, new_config, thing_to_keep: :new_thing, &block)
end

describe "#bridge" do
before { install_addon "binding-mqtt", ready_markers: "openhab.xmlThingTypes" }
before { install_addon "binding-dscalarm", ready_markers: "openhab.xmlThingTypes" }

it "can create a bridge" do
things.build do
bridge "mqtt:broker:mybroker", config: { host: "127.0.0.1" }
bridge "dscalarm:tcpserver:panel", config: { ipAddress: "127.0.0.1" }
end
end

it "can create nested things" do
things.build do
bridge "mqtt:broker:mybroker", config: { host: "127.0.0.1" } do
thing "mqtt:topic:mytopic", config: { stateTopic: "mything/mytopic" }
bridge "dscalarm:tcpserver:panel", config: { ipAddress: "127.0.0.1" } do
thing "dscalarm:zone:front_door", config: { zoneNumber: 1 }
end
end

expect(things["mqtt:topic:mytopic"].bridge_uid).to eq "mqtt:broker:mybroker"
expect(things["dscalarm:zone:front_door"].bridge_uid).to eq "dscalarm:tcpserver:panel"
end
end
end

0 comments on commit 996eb75

Please sign in to comment.