Sha256: 419a27927171a01f8b142533c1086f7d99ceda0c74a69ce31d342c57a7b61f0d

Contents?: true

Size: 446 Bytes

Versions: 1

Compression:

Stored size: 446 Bytes

Contents

module Mirage
  class MockResponseSet < Hash
    def fuzzy_find desired_key, http_method
      result = self[desired_key]
      return result unless result.nil?
      result = find_all do |key, value|
        key.is_a?(Regexp) && desired_key.is_a?(String) && key.match(desired_key) && value[http_method]
      end.sort do |a,b|
        b.first.source.size <=> a.first.source.size
      end
      result.first && result.first[1]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mirage-4.0.0.alpha5 server/mock_response_set.rb