Sha256: 286a91a8eadf2ddb06d719e72c103b7903b6dec1186d58f65b164b03b2fe1cdc

Contents?: true

Size: 870 Bytes

Versions: 5

Compression:

Stored size: 870 Bytes

Contents

require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))

# 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

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.4.0 test/integration/method_lookup_test.rb
gir_ffi-0.3.2 test/integration/method_lookup_test.rb
gir_ffi-0.3.1 test/integration/method_lookup_test.rb
gir_ffi-0.3.0 test/integration/method_lookup_test.rb
gir_ffi-0.2.3 test/integration/method_lookup_test.rb