summaryrefslogtreecommitdiff
path: root/spec/ffi_spec.rb
blob: f4a3a6e194c35470de3966532e5422d1a9cf8327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'spec_helper'

require 'ffi'

module LibyajlTestFFI
  extend ::FFI::Library

  libname = ::FFI.map_library_name("yajl")
  libpath = File.expand_path(File.join(Libyajl2.opt_path, libname))

  ffi_lib libpath

  attach_function :yajl_gen_alloc, [:pointer], :pointer
end

describe "when loading the library with FFI" do
  it "we can get back an FFI::Pointer from yajl_gen_alloc" do
    expect(LibyajlTestFFI.yajl_gen_alloc(nil)).to be_an_instance_of(FFI::Pointer)
  end
end