Sha256: f67110ed7af4607b0ea51c644e0e1dc9eb1c55726a1f872120589ec6b811304c
Contents?: true
Size: 835 Bytes
Versions: 187
Compression:
Stored size: 835 Bytes
Contents
module WebMock class RequestRegistry include Singleton attr_accessor :requested_signatures def initialize reset! end def reset! self.requested_signatures = Util::HashCounter.new end def times_executed(request_pattern) self.requested_signatures.hash.select { |request_signature, times_executed| request_pattern.matches?(request_signature) }.inject(0) {|sum, (_, times_executed)| sum + times_executed } end def to_s if requested_signatures.hash.empty? "No requests were made." else text = "" self.requested_signatures.each do |request_signature, times_executed| text << "#{request_signature} was made #{times_executed} time#{times_executed == 1 ? '' : 's' }\n" end text end end end end
Version data entries
187 entries across 176 versions & 14 rubygems