Sha256: 10c27dc7de3cca6e86143b64d3d004500b110fd380ce83d0aea3dbdd811d19d5

Contents?: true

Size: 1.57 KB

Versions: 5

Compression:

Stored size: 1.57 KB

Contents

require File.expand_path('../test_helper.rb', File.dirname(__FILE__))

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 Gtk" do
    setup do
      @gir = GObjectIntrospection::IRepository.default
      @gir.require 'Gtk', "2.0"
    end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.2.3 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.2.2 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.2.1 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.2.0 test/ffi-gobject_introspection/i_repository_test.rb
gir_ffi-0.1.0 test/ffi-gobject_introspection/i_repository_test.rb