Sha256: 8491e46424ee3db1db43981965366e65cec80a9e633449a3c09174d2f94489a4

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

require 'gir_ffi_test_helper'

describe GirFFI::Builder::Type::Interface do
  describe "#pretty_print" do
    it "returns a module block, extending InterfaceBase" do
      mock(info = Object.new).safe_name { "Bar" }
      stub(info).namespace { "Foo" }

      builder = GirFFI::Builder::Type::Interface.new(info)

      assert_equal "module Bar\n  extend InterfaceBase\nend", builder.pretty_print
    end
  end

  describe "#build_class" do
    before do
      info = get_introspection_data 'GObject', 'TypePlugin'
      @bldr = GirFFI::Builder::Type::Interface.new info
      @iface = @bldr.build_class
    end

    it "builds an interface as a module" do
      assert_instance_of Module, @iface
    end

    it "creates methods on the interface" do
      assert_defines_instance_method @iface, :complete_interface_info
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.4.3 test/gir_ffi/builder/type/interface_test.rb
gir_ffi-0.4.2 test/gir_ffi/builder/type/interface_test.rb
gir_ffi-0.4.1 test/gir_ffi/builder/type/interface_test.rb