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
cloudsmith-api-0.49.94 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
cloudsmith-api-0.49.21 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
cloudsmith-api-0.49.15 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
cloudsmith-api-0.49.13 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
cloudsmith-api-0.49.9 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/ethon-0.11.0/spec/ethon/curl_spec.rb
approveapi-1.0.8 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/curl_spec.rb
ethon-0.12.0 spec/ethon/curl_spec.rb
cloudsmith-api-0.30.7 vendor/bundle/ruby/2.3.0/gems/ethon-0.11.0/spec/ethon/curl_spec.rb
color_me_shop-1.0.0 vendor/bundle/ruby/2.5.0/gems/ethon-0.11.0/spec/ethon/curl_spec.rb
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/ethon-0.11.0/spec/ethon/curl_spec.rb
ethon-0.11.0 spec/ethon/curl_spec.rb
ethon-0.10.1 spec/ethon/curl_spec.rb
ethon-0.10.0 spec/ethon/curl_spec.rb
ethon-0.9.1 spec/ethon/curl_spec.rb
ethon-0.9.0 spec/ethon/curl_spec.rb
ethon-0.8.1 spec/ethon/curl_spec.rb
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/ethon-0.8.0/spec/ethon/curl_spec.rb