Sha256: edb3bba3644f7d2ab6c881225fc2cb38116918539c787920b5e0a3413beb2cd4

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require 'gir_ffi_test_helper'

GirFFI.setup :GIMarshallingTests

describe GirFFI::Builder::Type::UserDefined do
  describe "with a block with a call to #install_property" do
    before do
      @klass = Class.new GIMarshallingTests::OverridesObject
      Object.const_set "DerivedC#{Sequence.next}", @klass
      @builder = GirFFI::Builder::Type::UserDefined.new @klass do
        install_property GObject.param_spec_int("foo", "foo bar",
                                                "The Foo Bar Property",
                                                10, 20, 15,
                                                3)
      end
      @builder.build_class
    end

    it "has one property of type GirFFI::UserDefined::IPropertyInfo" do
      props = @builder.send(:properties)
      props.length.must_equal 1
      props[0].must_be_instance_of GirFFI::UserDefined::IPropertyInfo
    end

    describe "the info attribute" do
      before do
        @info = @builder.info
      end

      it "is an object of type GirFFI::UserDefined::IObjectInfo" do
        @info.must_be_instance_of GirFFI::UserDefined::IObjectInfo
      end

      it "knows about the single property :foo" do
        props = @info.properties
        props.length.must_equal 1
        foo_property = props[0]
        foo_property.must_be_instance_of GirFFI::UserDefined::IPropertyInfo
        foo_property.name.must_equal "foo"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-0.5.2 test/gir_ffi/builder/type/user_defined_test.rb
gir_ffi-0.5.1 test/gir_ffi/builder/type/user_defined_test.rb
gir_ffi-0.5.0 test/gir_ffi/builder/type/user_defined_test.rb
gir_ffi-0.4.3 test/gir_ffi/builder/type/user_defined_test.rb
gir_ffi-0.4.2 test/gir_ffi/builder/type/user_defined_test.rb
gir_ffi-0.4.1 test/gir_ffi/builder/type/user_defined_test.rb