Sha256: d79dc8bdc0061324c0b6c8da0389248987abcd00eda8a364679884d165525715

Contents?: true

Size: 853 Bytes

Versions: 9

Compression:

Stored size: 853 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

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.14.1 test/integration/method_lookup_test.rb
gir_ffi-0.14.0 test/integration/method_lookup_test.rb
gir_ffi-0.13.1 test/integration/method_lookup_test.rb
gir_ffi-0.13.0 test/integration/method_lookup_test.rb
gir_ffi-0.12.1 test/integration/method_lookup_test.rb
gir_ffi-0.12.0 test/integration/method_lookup_test.rb
gir_ffi-0.11.4 test/integration/method_lookup_test.rb
gir_ffi-0.11.3 test/integration/method_lookup_test.rb
gir_ffi-0.11.2 test/integration/method_lookup_test.rb