Sha256: 905d45b9b2711c54df57f258dc344b54de78e29e2706ccdffc1dcef8782d5459

Contents?: true

Size: 1.39 KB

Versions: 256

Compression:

Stored size: 1.39 KB

Contents

describe "JRuby extension", :jruby do
  let(:extension) { Appsignal::Extension }
  let(:jruby_module) { Appsignal::Extension::Jruby }

  it "creates a JRuby extension module" do
    expect(Appsignal::Extension::Jruby).to be_kind_of(Module)
  end

  describe "string conversions" do
    it "keeps the same value during string type conversions" do
      # UTF-8 string with NULL
      # Tests if the conversions between the conversions without breaking on
      # NULL terminated strings in C.
      string = "Merry Christmas! \u0000 🎄"

      appsignal_string = extension.make_appsignal_string(string)
      ruby_string = extension.make_ruby_string(appsignal_string)

      expect(ruby_string).to eq("Merry Christmas! \u0000 🎄")
    end
  end

  it "loads libappsignal with FFI" do
    expect(jruby_module.ffi_libraries.map(&:name).first).to include "libappsignal"
  end

  describe ".lib_extension" do
    subject { jruby_module.lib_extension }

    context "when on a darwin system" do
      before { expect(Appsignal::System).to receive(:agent_platform).and_return("darwin") }

      it "returns the extension for darwin" do
        is_expected.to eq "dylib"
      end
    end

    context "when on a linux system" do
      before { expect(Appsignal::System).to receive(:agent_platform).and_return("linux") }

      it "returns the lib extension for linux" do
        is_expected.to eq "so"
      end
    end
  end
end

Version data entries

256 entries across 256 versions & 1 rubygems

Version Path
appsignal-4.0.0.beta.1-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-4.0.0.beta.1 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.13.0-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.13.0 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.6-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.6 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.5-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.5 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.4-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.4 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.3-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.3 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.2-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.2 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.1-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.1 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.0-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.12.0 spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.11.0-java spec/lib/appsignal/extension/jruby_spec.rb
appsignal-3.11.0 spec/lib/appsignal/extension/jruby_spec.rb