Sha256: f67110ed7af4607b0ea51c644e0e1dc9eb1c55726a1f872120589ec6b811304c

Contents?: true

Size: 835 Bytes

Versions: 188

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

188 entries across 177 versions & 14 rubygems

Version Path
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/webmock-2.3.2/lib/webmock/request_registry.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/webmock-2.3.2/lib/webmock/request_registry.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/webmock-2.3.2/lib/webmock/request_registry.rb
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/webmock-1.21.0/lib/webmock/request_registry.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/webmock-1.21.0/lib/webmock/request_registry.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/webmock-2.3.2/lib/webmock/request_registry.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
webmock-2.3.2 lib/webmock/request_registry.rb
webmock-2.3.1 lib/webmock/request_registry.rb
webmock-2.2.0 lib/webmock/request_registry.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/webmock-1.24.6/lib/webmock/request_registry.rb
webmock-2.1.0 lib/webmock/request_registry.rb
webmock-2.0.3 lib/webmock/request_registry.rb