Skip to content

Commit

Permalink
Adjust specs for OH4.1 QuantityType changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jimmy Tanagra <[email protected]>
  • Loading branch information
jimtng committed Sep 13, 2023
1 parent 3d83170 commit 0a1da88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spec/openhab/core/types/quantity_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# quantity type operand
expect(QuantityType.new("50 °F") + QuantityType.new("50 °F")).to eql QuantityType.new("100.0 °F")
expect(QuantityType.new("50 °F") - QuantityType.new("25 °F")).to eql QuantityType.new("25.0 °F")
expect((QuantityType.new("100 °F") / QuantityType.new("2 °F")).to_i).to be 50
# @deprecated OH4.0 result of 50. OH 4.1 will result in 1. see https://github.com/openhab/openhab-core/pull/3792
expect((QuantityType.new("100 °F") / QuantityType.new("2 °F")).to_i).to be(50).or be(1)
expect(QuantityType.new("50 °F") + -QuantityType.new("25 °F")).to eql QuantityType.new("25.0 °F")

# numeric operand
Expand Down
4 changes: 3 additions & 1 deletion spec/openhab/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@
expect((c + f).format("%.1f %unit%")).to eq "44.1 °C"
expect(f - 2 < 20).to be true
expect(2 + c == 25).to be true
expect(2 * c == 46).to be true
# @deprecated OH4.0 result = 46. OH4.1 result = 319.15 °C
# this behavior changed since OH4.1.0.M1 see https://github.com/openhab/openhab-core/pull/3792
expect(2 * c).to eq(46).or eq(319.15 | "°C")
expect((2 * (f + c) / 2) < 45).to be true
expect([c, f, 2].min).to be 2
end
Expand Down

0 comments on commit 0a1da88

Please sign in to comment.