# These are helper methods for running rspec tests that give english names to mathematical operators module MathOperatorHelpers def less_than?(other) self < other end def less_than_or_equal_to?(other) self <= other end def greater_than?(other) self > other end def greater_than_or_equal_to?(other) self >= other end def between?(first, second) first <= self && self <= second end alias_method :before?, :less_than? alias_method :before_or_on?, :less_than_or_equal_to? alias_method :after?, :greater_than? alias_method :after_or_on?, :greater_than_or_equal_to? end %w(Integer Float Date DateTime Time).each do |class_name| eval <<-EOS class #{class_name} include MathOperatorHelpers end EOS end