Sha256: 9c2a1b9a34d54d2c09277ed867a6a5e79ba1d22ecd1be0ff4c6d3dc49ec58131
Contents?: true
Size: 563 Bytes
Versions: 3
Compression:
Stored size: 563 Bytes
Contents
module Bogus class WithArguments attr_reader :predicate def initialize(&predicate) @predicate = predicate end def matches?(args) predicate.call(*args) end def self.matches?(opts = {}) stubbed = opts.fetch(:stubbed) recorded = opts.fetch(:recorded) return false unless with_matcher?(stubbed) return extract(stubbed).matches?(recorded) end def self.with_matcher?(args) args.first.is_a?(WithArguments) end private def self.extract(args) args.first end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bogus-0.1.7 | lib/bogus/stubbing/matchers/with_arguments.rb |
bogus-0.1.6 | lib/bogus/stubbing/matchers/with_arguments.rb |
bogus-0.1.5 | lib/bogus/stubbing/matchers/with_arguments.rb |