Sha256: 6ca24a1e4451497473e321411a3a4a964405391c583b75a0a4fe95c2acf46bc8

Contents?: true

Size: 928 Bytes

Versions: 39

Compression:

Stored size: 928 Bytes

Contents

require 'spec_helper.rb'

describe Faraday::ApiKey do

  describe 'error' do

    stubs = Faraday::Adapter::Test::Stubs.new do |stub|
      stub.get('/products/123') {[ 200, {foo: 'hi'}, '']}
    end

    test = Faraday.new do |builder|
      builder.request :api_key
      builder.adapter :test, stubs
    end

    it 'should raise a configuration error' do
      expect {
        test.get('/products/123')
      }.to raise_error(Reviewed::ConfigurationError)
    end
  end

  describe 'no error' do

    stubs = Faraday::Adapter::Test::Stubs.new do |stub|
      stub.get('/products/123') {[ 200, {foo: 'hi'}, '']}
    end

    test = Faraday.new do |builder|
      builder.request :api_key
      builder.adapter :test, stubs
    end

    test.headers = { "X-Reviewed-Authorization" => '123' }

    it 'should not raise an error' do
      expect {
        test.get('/products/123')
      }.to_not raise_error
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
reviewed-1.2.4 spec/faraday/api_key_spec.rb
reviewed-1.2.3 spec/faraday/api_key_spec.rb
reviewed-1.3.0 spec/faraday/api_key_spec.rb
reviewed-1.2.2 spec/faraday/api_key_spec.rb
reviewed-1.2.0 spec/faraday/api_key_spec.rb
reviewed-1.1.0 spec/faraday/api_key_spec.rb
reviewed-1.0.4 spec/faraday/api_key_spec.rb
reviewed-1.0.3 spec/faraday/api_key_spec.rb
reviewed-1.0.2 spec/faraday/api_key_spec.rb
reviewed-1.0.1 spec/faraday/api_key_spec.rb
reviewed-1.0.0 spec/faraday/api_key_spec.rb
reviewed-0.9.1 spec/faraday/api_key_spec.rb
reviewed-0.9.0 spec/faraday/api_key_spec.rb
reviewed-0.8.0 spec/faraday/api_key_spec.rb
reviewed-0.7.1 spec/faraday/api_key_spec.rb
reviewed-0.7 spec/faraday/api_key_spec.rb
reviewed-0.6.4 spec/faraday/api_key_spec.rb
reviewed-0.6.3 spec/faraday/api_key_spec.rb
reviewed-0.6.2 spec/faraday/api_key_spec.rb
reviewed-0.6.1 spec/faraday/api_key_spec.rb