Sha256: 8723b9d42e35eb1e2b3bd35f4b8a6ad84e00815c36995b154258074bdf32bf9a

Contents?: true

Size: 1.56 KB

Versions: 13

Compression:

Stored size: 1.56 KB

Contents

require 'introspection_test_helper'

describe GObjectIntrospection::IRepository do
  describe "an instance" do
    should "not be created by calling new()" do
      assert_raises NoMethodError do
        GObjectIntrospection::IRepository.new
      end
    end

    should "be created by calling default()" do
      gir = GObjectIntrospection::IRepository.default
      assert_kind_of GObjectIntrospection::IRepository, gir
    end

    should "be a singleton" do
      gir = GObjectIntrospection::IRepository.default
      gir2 = GObjectIntrospection::IRepository.default
      assert_equal gir, gir2
    end
  end

  describe "#namespace" do
    should "raise an error if the namespace doesn't exist" do
      assert_raises RuntimeError do
        GObjectIntrospection::IRepository.default.require 'VeryUnlikelyGObjectNamespaceName', nil
      end
    end

    should "allow version to be nil" do
      assert_nothing_raised do
        GObjectIntrospection::IRepository.default.require 'GObject', nil
      end
    end

    should "allow version to be left out" do
      assert_nothing_raised do
        GObjectIntrospection::IRepository.default.require 'GObject'
      end
    end
  end

  describe "enumerating the infos for GObject" do
    setup do
      @gir = GObjectIntrospection::IRepository.default
      @gir.require 'GObject', "2.0"
    end

    should "yield more than one object" do
      assert_operator @gir.n_infos('GObject'), :>, 0
    end

    should "yield IBaseInfo objects" do
      assert_kind_of GObjectIntrospection::IBaseInfo, @gir.info('GObject', 0)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gir_ffi-0.6.6 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.6.5 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.6.4 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.6.3 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.6.2 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.6.1 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.6.0 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.5.2 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.5.1 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.5.0 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.4.3 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.4.2 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.4.1 test/ffi-gobject_introspection/i_repository_test.rb