Skip to content

Commit

Permalink
Fix entity lookup inside item builder's item block (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimtng authored Sep 29, 2023
1 parent 317a8ce commit 7c6bc98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/openhab/dsl/items/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def initialize(provider)

# The ItemBuilder DSL allows you to customize an Item
class ItemBuilder
include Core::EntityLookup

# The type of this item
# @example
# type #=> :switch
Expand Down
10 changes: 10 additions & 0 deletions spec/openhab/dsl/items/builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@
end
expect(gGroup2).to be_a(GroupItem)
end

it "can reference a group item within the item's block" do
items.build do
group_item "gTestGroup"
number_item "TestItem" do
group gTestGroup
end
end
expect(TestItem.groups).to eql [gTestGroup]
end
end

context "with a thing" do
Expand Down

0 comments on commit 7c6bc98

Please sign in to comment.