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.alpha92 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-oathkeeper-client-0.38.20.beta1 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha91 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha90 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha89 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha88 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha87 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha86 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha85 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha84 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha83 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha82 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha81 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha80 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha79 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha78 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha77 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha76 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha75 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb
ory-client-0.0.1.alpha74 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb