Class: Whitestone::Assertion::Nil

Inherits:
Base show all
Defined in:
lib/whitestone/assertion_classes.rb

Overview

class Assertion::False

Instance Method Summary collapse

Methods inherited from Base

#block

Methods included from Guards

#args_or_block_one_only, #block_required, #no_block_allowed, #one_argument, #two_arguments, #two_or_three_arguments, #type_check

Constructor Details

#initialize(mode, *args, &block) ⇒ Nil

Returns a new instance of Nil.



154
155
156
157
# File 'lib/whitestone/assertion_classes.rb', line 154

def initialize(mode, *args, &block)
  super
  @test_lambda = args_or_block_one_only(args, block)
end

Instance Method Details

#messageObject



161
162
163
164
165
166
167
# File 'lib/whitestone/assertion_classes.rb', line 161

def message
  msg = Col['Condition expected NOT to be nil'].yb
  case @mode
  when :assert then msg.sub(' NOT', '')
  when :negate then msg
  end
end

#runObject



158
159
160
# File 'lib/whitestone/assertion_classes.rb', line 158

def run
  @test_lambda.call.nil?
end