Sha256: d814739b79f8bb5e1f3e1e408555ea100124e162412396fa645b8fa1ddb2d5c4

Contents?: true

Size: 1.27 KB

Versions: 1796

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Ethon::Easy::Mirror do
  let(:options) { nil }
  let(:mirror) { described_class.new(options) }

  describe "::INFORMATIONS_TO_LOG" do
    [
      :return_code, :response_code, :response_body, :response_headers,
      :total_time, :starttransfer_time, :appconnect_time,
      :pretransfer_time, :connect_time, :namelookup_time, :redirect_time,
      :size_upload, :size_download, :speed_upload, :speed_upload,
      :effective_url, :primary_ip, :redirect_count, :debug_info
    ].each do |name|
      it "contains #{name}" do
        expect(described_class::INFORMATIONS_TO_MIRROR).to include(name)
      end
    end
  end

  describe "#to_hash" do
    let(:options) { {:return_code => 1} }

    it "returns mirror as hash" do
      expect(mirror.to_hash).to eq(options)
    end
  end

  describe "#log_informations" do
    let(:options) { {:return_code => 1} }

    it "returns hash" do
      expect(mirror.log_informations).to be_a(Hash)
    end

    it "only calls methods that exist" do
      described_class::INFORMATIONS_TO_LOG.each do |method_name|
        expect(mirror.respond_to? method_name).to eql(true)
      end
    end

    it "includes return code" do
      expect(mirror.log_informations).to include(options)
    end
  end
end

Version data entries

1,796 entries across 1,794 versions & 15 rubygems

Version Path
ory-client-0.0.1.alpha39 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha38 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha37 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha36 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-kratos-client-0.8.2.alpha1 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha31 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha30 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha29 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha28 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha27 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha24 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha23 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-kratos-client-0.8.0.alpha2 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-client-0.0.1.alpha21 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ory-keto-client-0.7.0.alpha1 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb
ethon-0.15.0 spec/ethon/easy/mirror_spec.rb