Sha256: 824d31b8e6d575d5479b349889b942e1958fef1b6473ebdd76e37210c9e33a69
Contents?: true
Size: 864 Bytes
Versions: 1
Compression:
Stored size: 864 Bytes
Contents
module Xpect class Matchers def self.anything lambda {|_| true } end def self.nil lambda do |val| unless val.nil? raise_error("'#{ val }' is not nil.") end true end end def self.falsy lambda do |val| if val.is_a?(Integer) || val.is_a?(Float) raise_error("'#{ val }' is not falsy.") end if val.nil? || val.empty? return true end raise_error("'#{ val }' is not falsy.") end end def self.truthy lambda do |val| if val.is_a?(Integer) || val.is_a?(Float) return true end if val.nil? || val.empty? raise_error("'#{ val }' is not truthy.") end true end end def self.raise_error(msg) raise FailedSpec, msg end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xpect-0.1.0 | lib/xpect/matchers.rb |