Sha256: c989dba231f70e9bcbadb5d3bc90582c06636dbe067b5fcea7983ded78d7bfb5

Contents?: true

Size: 838 Bytes

Versions: 1

Compression:

Stored size: 838 Bytes

Contents

shared_context 'with a running app' do
  let(:app) { Rack::Builder.parse_file('config.ru').first }
end

shared_context 'with token authorization' do
  before(:each) do
    permitted_token = ENV['PERMITTED_TOKENS'].split(',').first if ENV['PERMITTED_TOKENS']
    header 'Http-Authorization', permitted_token
  end
  let(:permitted_token) { ENV['PERMITTED_TOKENS'].split(',').first }
end

shared_context 'with a running app and client' do
  include_context 'with a running app'
  include_context 'with token authorization'

  let(:client) do
    Hyperclient.new('http://example.org/') do |client|
      client.headers['Http-Authorization'] = permitted_token
      client.connection(default: false) do |conn|
        conn.request :hal_json
        conn.response :json
        conn.use Faraday::Adapter::Rack, app
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gris-0.2.4 lib/gris/generators/templates/scaffold/spec/support/app_helper.rb