Sha256: 600824dd51c4c1d03e06535ad3d5d96cc22b6c08e5eb41224359248f31a84313
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
# -*- encoding : utf-8 -*- module Pacto class InvestigationRegistry include Singleton include Logger include Resettable attr_reader :investigations def initialize @investigations = [] end def self.reset! instance.reset! end def reset! @investigations.clear @stenographer = nil end def validated?(request_pattern) matched_investigations = @investigations.select do |investigation| request_pattern.matches? investigation.request end matched_investigations unless matched_investigations.empty? end def register_investigation(investigation) @investigations << investigation stenographer.log_investigation investigation logger.info "Detected #{investigation.summary}" logger.debug(investigation.to_s) unless investigation.successful? investigation end def unmatched_investigations @investigations.select do |investigation| investigation.contract.nil? end end def failed_investigations @investigations.select do |investigation| !investigation.successful? end end protected def stenographer @stenographer ||= create_stenographer end def create_stenographer stenographer_log = File.open(Pacto.configuration.stenographer_log_file, 'a+') Pacto::Observers::Stenographer.new stenographer_log end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pacto-0.4.0.rc3 | lib/pacto/core/investigation_registry.rb |
pacto-0.4.0.rc2 | lib/pacto/core/investigation_registry.rb |
pacto-0.4.0.rc1 | lib/pacto/core/investigation_registry.rb |