Sha256: c982364801f6fa69d9517d9891cfd91b08f86310587f276acc732640199f39e4

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

require 'gir_ffi_test_helper'
require 'gir_ffi/user_defined_type_info'

describe GirFFI::UserDefinedTypeInfo do
  describe "#described_class" do
    it "returns the class passed to #initialize" do
      info = GirFFI::UserDefinedTypeInfo.new :some_class
      info.described_class.must_equal :some_class
    end
  end

  describe "#install_property" do
    it "adds the passed in property to the list of properties" do
      mock(foo_spec = Object.new).get_name { :foo }

      info = GirFFI::UserDefinedTypeInfo.new :some_class
      info.install_property foo_spec
      info.properties.map(&:name).must_equal [:foo]
    end
  end

  describe "#initialize" do
    it "takes a block that is evaluated in the context of the instance" do
      mock(foo_spec = Object.new).get_name { :foo }
      mock(bar_spec = Object.new).get_name { :bar }

      info = GirFFI::UserDefinedTypeInfo.new :some_class do
        install_property foo_spec
        install_property bar_spec
      end
      info.properties.map(&:name).must_equal [:foo, :bar]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gir_ffi-0.6.7 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.6 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.5 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.4 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.3 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.2 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.1 test/gir_ffi/user_defined_type_info_test.rb
gir_ffi-0.6.0 test/gir_ffi/user_defined_type_info_test.rb