Sha256: 0a4ec0944d23433886610a9706aeee66d355c4f6fa6704e4a7e3ba1bffeb89e1

Contents?: true

Size: 1.68 KB

Versions: 49

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'
require 'protobuf'

describe ::Protobuf do

  describe '.connector_type' do
    before { described_class.instance_variable_set(:@_connector_type, nil) }

    it 'defaults to socket' do
      described_class.connector_type.should eq :socket
    end

    it 'accepts socket, evented, or zmq' do
      [:socket, :evented, :zmq].each do |type|
        described_class.connector_type = type
        described_class.connector_type.should eq type
      end
    end

    it 'does not accept other types' do
      [:hello, :world].each do |type|
        expect {
          described_class.connector_type = type
        }.to raise_error(ArgumentError)
      end
    end
  end

  describe '.gc_pause_server_request?' do
    before { described_class.instance_variable_set(:@_gc_pause_server_request, nil) }

    it 'defaults to a false value' do
      described_class.gc_pause_server_request?.should be_false
    end

    it 'is settable' do
      described_class.gc_pause_server_request = true
      described_class.gc_pause_server_request?.should be_true
    end
  end

  describe '.print_deprecation_warnings?' do
    before { described_class.instance_variable_set(:@_print_deprecation_warnings, nil) }

    it 'defaults to a true value' do
      described_class.print_deprecation_warnings?.should be_true
    end

    it 'is settable' do
      described_class.print_deprecation_warnings = false
      described_class.print_deprecation_warnings?.should be_false
    end

    context 'when ENV["PB_IGNORE_DEPRECATIONS"] present' do
      it 'defaults to a false value' do
        ENV['PB_IGNORE_DEPRECATIONS'] = '1'
        described_class.print_deprecation_warnings?.should be_false
      end
    end
  end

end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
protobuf-2.5.0-java spec/lib/protobuf_spec.rb
protobuf-2.5.0 spec/lib/protobuf_spec.rb
protobuf-2.4.8-java spec/lib/protobuf_spec.rb
protobuf-2.4.8 spec/lib/protobuf_spec.rb
protobuf-2.4.7-java spec/lib/protobuf_spec.rb
protobuf-2.4.7 spec/lib/protobuf_spec.rb
protobuf-2.4.6 spec/lib/protobuf_spec.rb
protobuf-2.4.5-java spec/lib/protobuf_spec.rb
protobuf-2.4.5 spec/lib/protobuf_spec.rb
protobuf-2.4.4-java spec/lib/protobuf_spec.rb
protobuf-2.4.4 spec/lib/protobuf_spec.rb
protobuf-2.4.3-java spec/lib/protobuf_spec.rb
protobuf-2.4.3 spec/lib/protobuf_spec.rb
protobuf-2.4.3.rc1 spec/lib/protobuf_spec.rb
protobuf-2.4.2-java spec/lib/protobuf_spec.rb
protobuf-2.4.2 spec/lib/protobuf_spec.rb
protobuf-2.4.1-java spec/lib/protobuf_spec.rb
protobuf-2.4.1 spec/lib/protobuf_spec.rb
protobuf-2.4.0-java spec/lib/protobuf_spec.rb
protobuf-2.4.0 spec/lib/protobuf_spec.rb