Skip to content

Commit

Permalink
Merge pull request #160 from adrianocastro189/version-1.13.0/se6
Browse files Browse the repository at this point in the history
Implement Setting:isTrue()
  • Loading branch information
adrianocastro189 authored Sep 6, 2024
2 parents 6ce50d7 + 8ca3f3a commit 16441bb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Core/Settings/Setting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ local Setting = {}
@treturn boolean Whether the setting stored value evaluates to true
]]
function Setting:isTrue()
-- @TODO: Implement this method in SE6 <2024.09.05>
return self.__.bool:isTrue(self:getValue())
end

--[[--
Expand Down
22 changes: 20 additions & 2 deletions tests/Core/Setting/SettingTest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,27 @@ TestCase.new()
TestCase.new()
:setName('isTrue')
:setTestClass(TestSetting)
:setExecution(function()
-- @TODO: Implement this method in SE6 <2024.09.05>
:setExecution(function(data)
local instance = Spy
.new(__:new('Setting'))
:mockMethod('getValue', function() return data.value end)

lu.assertEquals(data.expectedResult, instance:isTrue())
end)
:setScenarios({
['true'] = {
value = true,
expectedResult = true,
},
['false'] = {
value = false,
expectedResult = false,
},
['nil'] = {
value = nil,
expectedResult = false,
},
})
:register()

-- @covers Setting:setValue()
Expand Down

0 comments on commit 16441bb

Please sign in to comment.