Sha256: 0a03807d56b23dc2c108a0ad816b9816149a0122a043960edada2934c4bf71c5

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 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
        Ethon::Curl.should_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 { Ethon::Curl.should_receive(:global_init).and_return(0) }

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

      it "logs" do
        Ethon.logger.should_receive(:debug)
        Ethon::Curl.init
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ethon-0.7.0 spec/ethon/curl_spec.rb
ethon-0.6.3 spec/ethon/curl_spec.rb
ethon-0.6.2 spec/ethon/curl_spec.rb
ethon-0.6.1 spec/ethon/curl_spec.rb
ethon-0.6.0 spec/ethon/curl_spec.rb