Sha256: 561f9cbf43f4b6019c3e99a4a51bf4bc73b04c0006ed8d723c200eb8d71bd768

Contents?: true

Size: 852 Bytes

Versions: 8

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true
require 'gir_ffi_test_helper'

# Tests how methods are looked up and generated on first use.
describe 'Looking up methods' do
  before do
    save_module :Regress
    GirFFI.setup :Regress
  end

  describe 'an instance method' do
    it 'is found from a subclass' do
      assert_defines_instance_method Regress::TestObj, :forced_method
      refute_defines_instance_method Regress::TestSubObj, :forced_method

      sub_object = Regress::TestSubObj.new
      sub_object.forced_method
    end
  end

  describe 'a class method' do
    it 'is found from a subclass' do
      assert_defines_singleton_method Regress::TestObj, :static_method
      refute_defines_singleton_method Regress::TestSubObj, :static_method

      Regress::TestSubObj.static_method 42
    end
  end

  after do
    restore_module :Regress
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gir_ffi-0.11.1 test/integration/method_lookup_test.rb
gir_ffi-0.10.2 test/integration/method_lookup_test.rb
gir_ffi-0.10.1 test/integration/method_lookup_test.rb
gir_ffi-0.10.0 test/integration/method_lookup_test.rb
gir_ffi-0.10.0.pre1 test/integration/method_lookup_test.rb
gir_ffi-0.9.5 test/integration/method_lookup_test.rb
gir_ffi-0.9.4 test/integration/method_lookup_test.rb
gir_ffi-0.9.3 test/integration/method_lookup_test.rb