Sha256: 29f2a77a5fd964ed90cc01c50c90ea2fd0636d7735581e7bd7db6e060aa56cc5
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
module BaconExpect module Matcher module BaconContext def be_nil BeNil.new end def be_true BeTrue.new end def be_false BeFalse.new end def raise_error(exception_class = Exception, message = "") RaiseError.new(exception_class, message) end def eql(value) Eql.new(value) end alias_method :be, :eql def match(regex) Match.new(regex) end def match_array(array) MatchArray.new(array) end alias_method :contain_exactly, :match_array def include(*values) Include.new(*values) end def have(number) HaveItems.new(number) end def satisfy(&block) Satisfy.new(&block) end def respond_to(method_name) RespondTo.new(method_name) end def start_with(substring) StartWith.new(substring) end def end_with(substring) EndWith.new(substring) end def change(&change_block) Change.new(change_block) end def method_missing(method_name, *args, &block) string_method_name = method_name.to_s match_be = string_method_name.match(/^be_(.*)/) if match_be BeGeneric.new(match_be[1], *args) else match_have = string_method_name.match(/^have_(.*)/) if match_have HaveGeneric.new(match_have[1], *args) else super end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bacon-expect-1.0.1 | lib/bacon-expect/matchers/matchers.rb |
bacon-expect-0.1 | lib/bacon-expect/matchers/matchers.rb |