Class: Mongomatic::Expectations::Present

Inherits:
Expectation show all
Defined in:
lib/mongomatic/expectations/present.rb

Instance Attribute Summary

Attributes inherited from Expectation

#instance, #message, #opts, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Expectation

#add_error_msg, define_to_be?, define_to_not_be?, inherited, #initialize

Constructor Details

This class inherits a constructor from Mongomatic::Expectations::Expectation

Class Method Details

.nameObject



4
5
6
# File 'lib/mongomatic/expectations/present.rb', line 4

def self.name
  "present"
end

Instance Method Details

#to_beObject



8
9
10
# File 'lib/mongomatic/expectations/present.rb', line 8

def to_be
  add_error_msg if value.blank?
end

#to_not_beObject



12
13
14
# File 'lib/mongomatic/expectations/present.rb', line 12

def to_not_be
  add_error_msg unless value.blank?
end