Sha256: 8a1937e1a391d6ae3b3b3150f2e1c10596981c06f9e67ebaceab0d58f27d12c4

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

require 'introspection_test_helper'

describe GObjectIntrospection::IRepository do
  let(:gir) { GObjectIntrospection::IRepository.default }

  describe 'an instance' do
    it 'is not created by calling new()' do
      assert_raises NoMethodError do
        GObjectIntrospection::IRepository.new
      end
    end

    it 'is created by calling default()' do
      assert_kind_of GObjectIntrospection::IRepository, gir
    end

    it 'is a singleton' do
      gir2 = GObjectIntrospection::IRepository.default
      assert_equal gir, gir2
    end
  end

  describe '#require' do
    it "raises an error if the namespace doesn't exist" do
      assert_raises RuntimeError do
        gir.require 'VeryUnlikelyGObjectNamespaceName', nil
      end
    end

    it 'allows version to be nil' do
      gir.require 'GObject', nil
      pass
    end

    it 'allows version to be left out' do
      gir.require 'GObject'
      pass
    end
  end

  describe '#find_by_gtype' do
    it 'raises an error if 0 is passed as the gtype' do
      proc { gir.find_by_gtype 0 }.must_raise ArgumentError
    end
  end

  describe '#n_infos' do
    it 'yields more than one object for the GObject namespace' do
      gir.require 'GObject', '2.0'
      assert_operator gir.n_infos('GObject'), :>, 0
    end
  end

  describe '#info' do
    it 'yields IBaseInfo objects' do
      gir.require 'GObject', '2.0'
      assert_kind_of GObjectIntrospection::IBaseInfo, gir.info('GObject', 0)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gir_ffi-0.9.2 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.9.1 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.9.0 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.6 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.5 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.4 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.3 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.2 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.1 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.8.0 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.7.10 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.7.9 test/ffi-gobject_introspection/i_repository_test.rb