Class: Expect::IsNotNil
- Inherits:
-
ExpectBase
- Object
- ExpectBase
- Expect::IsNotNil
- Defined in:
- lib/expect.rb
Overview
Checks if actual is not nil
Instance Attribute Summary
Attributes inherited from ExpectBase
Instance Method Summary collapse
-
#initialize(actual) ⇒ IsNotNil
constructor
A new instance of IsNotNil.
-
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult.
Constructor Details
#initialize(actual) ⇒ IsNotNil
Returns a new instance of IsNotNil.
71 72 73 |
# File 'lib/expect.rb', line 71 def initialize(actual) super(actual: actual) end |
Instance Method Details
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult
77 78 79 80 81 |
# File 'lib/expect.rb', line 77 def run return AssertPass.new unless @actual.nil? AssertFailure.new("IsNotNil failed: Expected #{@actual} to not be nil.") end |