Sha256: 0ea435293ea93bfabd48821d5c2a1525019c13ff2c65db3203a1343dbe045d94

Contents?: true

Size: 1.32 KB

Versions: 34

Compression:

Stored size: 1.32 KB

Contents

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

34 entries across 33 versions & 7 rubygems

Version Path
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.53.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.53.17 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.51.22 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/debug_info_spec.rb