Sha256: cf4386388ab5e0ab69e514621b946d744373f5ed951758e07927059a595d6312

Contents?: true

Size: 653 Bytes

Versions: 10

Compression:

Stored size: 653 Bytes

Contents

module Picky

  class TestClient < Client

    attr_reader :request

    #
    #
    # Example:
    #   Picky::TestClient.new(BookSearch, :path => '/books')
    #
    def initialize rack_app, options = {}
      super options

      @request = Rack::MockRequest.new rack_app
    end

    # Wraps the search method to always extend the result with Convenience.
    #
    def search query, params = {}
      super.extend Convenience
    end

    # Backend method that we override to not send a real search.
    #
    def send_search params = {}
      params = defaultize params

      request.get("#{self.path}?#{params.to_query}").body
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
picky-client-2.7.0 lib/picky-client/spec/test_client.rb
picky-client-2.6.0 lib/picky-client/spec/test_client.rb
picky-client-2.5.2 lib/picky-client/spec/test_client.rb
picky-client-2.5.1 lib/picky-client/spec/test_client.rb
picky-client-2.5.0 lib/picky-client/spec/test_client.rb
picky-client-2.4.3 lib/picky-client/spec/test_client.rb
picky-client-2.4.2 lib/picky-client/spec/test_client.rb
picky-client-2.4.1 lib/picky-client/spec/test_client.rb
picky-client-2.4.0 lib/picky-client/spec/test_client.rb
picky-client-2.3.0 lib/picky-client/spec/test_client.rb