Sha256: dc08096142fd56009ee211ab5ff5deaae5f2f0f556cdbc8efeaa2f21fe18fd14

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

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

  describe ".informations_to_mirror" do
    [
      :return_code, :response_code, :response_body, :response_headers,
      :total_time, :starttransfer_time, :appconnect_time,
      :pretransfer_time, :connect_time, :namelookup_time, :redirect_time,
      :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

4 entries across 4 versions & 2 rubygems

Version Path
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/ethon-0.8.0/spec/ethon/easy/mirror_spec.rb
ethon-0.8.0 spec/ethon/easy/mirror_spec.rb
ethon-0.7.4 spec/ethon/easy/mirror_spec.rb
ethon-0.7.3 spec/ethon/easy/mirror_spec.rb