Sha256: 1601f4a4acc00252de56adc20f6cd2405440fccc46dd168c1df3967ff7825be2

Contents?: true

Size: 1 KB

Versions: 6758

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Ethon::Curl do
  describe ".init" do
    before { Ethon::Curl.send(:class_variable_set, :@@initialized, false) }

    context "when global_init fails" do
      it "raises global init error" do
        expect(Ethon::Curl).to receive(:global_init).and_return(1)
        expect{ Ethon::Curl.init }.to raise_error(Ethon::Errors::GlobalInit)
      end
    end

    context "when global_init works" do
      before { expect(Ethon::Curl).to receive(:global_init).and_return(0) }

      it "doesn't raises global init error" do
        expect{ Ethon::Curl.init }.to_not raise_error
      end

      it "logs" do
        expect(Ethon.logger).to receive(:debug)
        Ethon::Curl.init
      end
    end

    context "when global_cleanup is called" do
      before { expect(Ethon::Curl).to receive(:global_cleanup) }

      it "logs" do
        expect(Ethon.logger).to receive(:debug).twice
        Ethon::Curl.init
        Ethon::Curl.cleanup
      end
    end
  end
end

Version data entries

6,758 entries across 6,756 versions & 22 rubygems

Version Path
ory-client-0.0.1.alpha107 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-hydra-client-1.11.7 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha106 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-hydra-client-1.11.6 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-keto-client-0.8.0.alpha1 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha105 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha104 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha103 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-hydra-client-1.11.5 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
cloudsmith-api-1.30.0 vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha101 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha100 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-hydra-client-1.11.4 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha99 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha98 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha97 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha96 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha95 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha94 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha93 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb