Sha256: 6b956174bff3d6ae85ae086e6bd2902798bcf7a8b977bc96e03800856e4103b5
Contents?: true
Size: 555 Bytes
Versions: 1
Compression:
Stored size: 555 Bytes
Contents
# frozen_string_literal: true require 'forwardable' class RestService extend Forwardable attr_reader :path, :service, :browser def initialize(params = {}) defaults = { service: Sinatra::Base, path: '/' } defaults.merge! params @service = defaults[:service] @path = defaults[:path] @browser = Rack::Test::Session.new(Rack::MockSession.new(@service)) end def_delegators :@browser, :get, :post, :put, :delete def returned_data JSON.parse(@browser.last_response.body, symbolize_names: true) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-rest-rspec-1.0.0 | lib/rack-rest-rspec/lib/rest_service.rb |