Sha256: 2d874eff9466bf0f0a8fc274b4f37c1f16bffed06194b95823bb48ddb49cc5f3

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

# encoding: CP1251
require 'spec_helper'

describe P2::Library do

  context 'at initialization' do
    it 'works only with pre-registered STA P2ClientGate typelib' do
      libs = WIN32OLE_TYPELIB.typelibs
      p2libs = libs.select { |t| t.name=~/P2ClientGate/ }
      print 'Registered P2ClientGate libs: '
      p p2libs.map &:guid
      p2sta = p2libs.find { |t| t.name !~ /MTA/ }
      p2sta.should_not be_nil
      print 'P2ClientGate (STA) OLE types: '
      p2sta.ole_types.map { |k| p [k.name, k.progid, k.guid, k.implemented_ole_types] }
    end

    it 'wraps STA P2ClientGate typelib' do
      lib = P2::Library.new
      lib.name.should =~ /P2ClientGate/
      lib.name.should_not =~ /MTA/
    end
  end # initialization

  describe '.default' do
    it 'points to (initialized) STA P2ClientGate OLE typelib singleton' do
      P2::Library.default.should be_an_instance_of P2::Library
    end
  end

  context 'when initialized' do
    let(:lib) { P2::Library.default }

    describe '#find' do
      it 'returns progid needed to create OLE type with a given name' do
        lib.find("P2Application").should == "P2ClientGate.P2Application.1"
        lib.find("App").should == "P2ClientGate.P2Application.1"
      end
    end

  end # when initialized
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
p2ruby-0.1.5 spec/p2ruby/library_spec.rb
p2ruby-0.1.4 spec/p2ruby/library_spec.rb