Sha256: eb3a0314b411e15e74184c121599305772a6c694f37add2a612e4fa3f68275d9

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

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

module GirFFI
  class IRepositoryTest < Test::Unit::TestCase
    context "An IRepository object" do
      should "not be created by calling new()" do
	assert_raise NoMethodError do
	  IRepository.new
	end
      end

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

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

    context "The namespace method" do
      should "raise an error if the namespace doesn't exist" do
	assert_raise RuntimeError do
	  IRepository.default.require 'VeryUnlikelyGObjectNamespaceName', nil
	end
      end

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

    context "Enumerating the infos" do
      setup do
	@gir = IRepository.default
	@gir.require 'Gtk', nil
      end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.0.2 test/i_repository_test.rb
gir_ffi-0.0.1 test/i_repository_test.rb