Sha256: a73af2d519dc2d5e713d795ab9b6c8311b1f49b73669cb24e93050c98ccad88e

Contents?: true

Size: 1005 Bytes

Versions: 13

Compression:

Stored size: 1005 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
begin
  require 'yajl/bzip2'
rescue
  warn "Couldn't load yajl/bzip2, maybe you don't have bzip2-ruby installed? Continuing without running bzip2 specs."
end
require 'yajl/gzip'
require 'yajl/deflate'
require 'yajl/http_stream'

describe "Yajl HTTP error" do
  before do
    @uri = 'file://' + File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.error.dump")
    @request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.error.dump"), 'r')
    allow(TCPSocket).to receive(:new).and_return(@request)
    allow(@request).to receive(:write)
    begin
      Yajl::HttpStream.get(@uri)
    rescue Yajl::HttpStream::HttpError => e
      @error = e
    end
  end

  it "should contain the error code in the message" do
    expect(@error.message).to match(/404/)
  end

  it "should provide the HTTP response headers" do
    expect(@error.headers.keys).to include('ETag', 'Content-Length', 'Server')
  end
end

Version data entries

13 entries across 13 versions & 6 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_error_spec.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_error_spec.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_error_spec.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_error_spec.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/yajl-ruby-1.4.3/spec/http/http_error_spec.rb
yajl-ruby-1.4.3 spec/http/http_error_spec.rb
yajl-ruby-1.4.2 spec/http/http_error_spec.rb
yajl-ruby-1.4.1 spec/http/http_error_spec.rb
yajl-ruby-1.4.0 spec/http/http_error_spec.rb
yajl-ruby-1.3.1 spec/http/http_error_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/spec/http/http_error_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/spec/http/http_error_spec.rb
yajl-ruby-1.3.0 spec/http/http_error_spec.rb