Sha256: 039e92253f20cb235a533f5e36c63dd0a64c505637503c57941524869aeda3f5

Contents?: true

Size: 995 Bytes

Versions: 41

Compression:

Stored size: 995 Bytes

Contents

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

41 entries across 40 versions & 8 rubygems

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