Sha256: b56dec048d474a606e9607c2d0a4540086a32e4a2ff0be1ff2d9fb06ee0050b4

Contents?: true

Size: 1.35 KB

Versions: 6802

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Ethon::Easy::DebugInfo do
  let(:easy) { Ethon::Easy.new }

  before do
    easy.url = "http://localhost:3001/"
    easy.perform
  end

  describe "#debug_info" do
    context "when verbose is not set to true" do
      it "does not save any debug info after a request" do
        expect(easy.debug_info.to_a.length).to eq(0)
        expect(easy.debug_info.to_h.values.flatten.length).to eq(0)
      end
    end

    context "when verbose is set to true" do
      before do
        easy.verbose = true
        easy.perform
      end

      after do
        easy.verbose = false
        easy.reset
      end

      it "saves debug info after a request" do
        expect(easy.debug_info.to_a.length).to be > 0
      end

      it "saves request headers" do
        expect(easy.debug_info.header_out.join).to include('GET / HTTP/1.1')
      end

      it "saves response headers" do
        expect(easy.debug_info.header_in.length).to be > 0
        expect(easy.response_headers).to include(easy.debug_info.header_in.join)
      end

      it "saves incoming data" do
        expect(easy.debug_info.data_in.length).to be > 0
        expect(easy.response_body).to include(easy.debug_info.data_in.join)
      end

      it "saves debug text" do
        expect(easy.debug_info.text.length).to be > 0
      end
    end
  end
end

Version data entries

6,802 entries across 6,800 versions & 23 rubygems

Version Path
ory-client-0.0.1.alpha144 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha143 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha142 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha141 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha140 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha139 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha138 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha134 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha133 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha132 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha131 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-1.42.3 vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha130 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha129 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha128 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha127 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb
ory-client-0.0.1.alpha126 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb