Class: Expect::IsNil
- Inherits:
-
ExpectBase
- Object
- ExpectBase
- Expect::IsNil
- Defined in:
- lib/expect.rb
Overview
Checks if actual is nil
Instance Attribute Summary
Attributes inherited from ExpectBase
Instance Method Summary collapse
-
#initialize(actual) ⇒ IsNil
constructor
A new instance of IsNil.
-
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult.
Constructor Details
#initialize(actual) ⇒ IsNil
Returns a new instance of IsNil.
56 57 58 |
# File 'lib/expect.rb', line 56 def initialize(actual) super(actual: actual) end |
Instance Method Details
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult
62 63 64 65 66 |
# File 'lib/expect.rb', line 62 def run return AssertPass.new if @actual.nil? AssertFailure.new("IsNil failed: Expected #{@actual} to be nil.") end |