Sha256: 5a5f009768c2fc50e6c5d1d5eabf400d933089624ccee4a52b1e5763b85f4f4a

Contents?: true

Size: 821 Bytes

Versions: 19

Compression:

Stored size: 821 Bytes

Contents

require 'spec_helper'
require 'hyperclient'

describe 'token authentication' do
  include_context 'with a generated app'

  let(:client_url) { "http://localhost:#{app_port}" }
  let(:client) { Hyperclient.new(client_url) }

  it 'returns a forbidden error' do
    request = Faraday.get client_url
    response = JSON.parse request.body
    expect(response['error']).to include 'Forbidden'
  end

  context 'with correct token query params' do
    it 'returns the root presenter' do
      client.params['token'] = 'replace-me'
      expect(client._links.self._url).to eq client_url
    end
  end

  context 'with correct Http-Authorization headers' do
    it 'returns the root presenter' do
      client.headers['Http-Authorization'] = 'replace-me'
      expect(client._links.self._url).to eq client_url
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
gris-0.4.7 spec/integration/token_authentication_spec.rb
gris-0.4.6 spec/integration/token_authentication_spec.rb
gris-0.4.5 spec/integration/token_authentication_spec.rb
gris-0.4.4 spec/integration/token_authentication_spec.rb
gris-0.4.3 spec/integration/token_authentication_spec.rb
gris-0.4.2 spec/integration/token_authentication_spec.rb
gris-0.4.0 spec/integration/token_authentication_spec.rb
gris-0.3.9 spec/integration/token_authentication_spec.rb
gris-0.3.8 spec/integration/token_authentication_spec.rb
gris-0.3.7 spec/integration/token_authentication_spec.rb
gris-0.3.6 spec/integration/token_authentication_spec.rb
gris-0.3.4 spec/integration/token_authentication_spec.rb
gris-0.3.3 spec/integration/token_authentication_spec.rb
gris-0.3.2 spec/integration/token_authentication_spec.rb
gris-0.3.1 spec/integration/token_authentication_spec.rb
gris-0.3.0 spec/integration/token_authentication_spec.rb
gris-0.2.4 spec/integration/token_authentication_spec.rb
gris-0.2.3 spec/integration/token_authentication_spec.rb
gris-0.2.2 spec/integration/token_authentication_spec.rb