Class: Expect::IsTrue
- Inherits:
-
ExpectBase
- Object
- ExpectBase
- Expect::IsTrue
- Defined in:
- lib/expect.rb
Overview
Checks if actual is truthy
Instance Attribute Summary
Attributes inherited from ExpectBase
Instance Method Summary collapse
-
#initialize(actual) ⇒ IsTrue
constructor
A new instance of IsTrue.
-
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult.
Constructor Details
#initialize(actual) ⇒ IsTrue
Returns a new instance of IsTrue.
86 87 88 |
# File 'lib/expect.rb', line 86 def initialize(actual) super(actual: actual) end |
Instance Method Details
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult
92 93 94 95 96 97 |
# File 'lib/expect.rb', line 92 def run return AssertPass.new if @actual @actual = @actual.nil? ? '<nil>' : @actual AssertFailure.new("IsTrue failed: Expected #{@actual} to be true.") end |