Sha256: c26f94de07e4801c270e94742dd94203b07cbaeab7a16949473c4fe16d69325e

Contents?: true

Size: 727 Bytes

Versions: 6

Compression:

Stored size: 727 Bytes

Contents

require 'spec_helper'
require 'rack/test'
require_relative '../lib/inferno/apps/web/application'
require_relative '../lib/inferno/utils/middleware/request_logger'

module RequestHelpers
  def app
    Rack::Builder.new do
      use Inferno::Utils::Middleware::RequestLogger
      run Inferno::Web.app
    end
  end

  def post_json(path, data)
    post path, data.to_json, 'CONTENT_TYPE' => 'application/json'
  end

  def parsed_body
    JSON.parse(last_response.body)
  end
end

RSpec.configure do |config|
  config.define_derived_metadata(file_path: %r{/spec/requests/}) do |metadata|
    metadata[:request] = true
  end

  config.include Rack::Test::Methods, request: true
  config.include RequestHelpers, request: true
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inferno_core-0.6.1 spec/request_helper.rb
inferno_core-0.6.0 spec/request_helper.rb
inferno_core-0.5.4 spec/request_helper.rb
inferno_core-0.5.3 spec/request_helper.rb
inferno_core-0.5.2 spec/request_helper.rb
inferno_core-0.5.1 spec/request_helper.rb