Sha256: e0cba374ffae4be5a7f5ef24127e6e4116dbae08cda9c8155627c734d81c13d3

Contents?: true

Size: 993 Bytes

Versions: 7

Compression:

Stored size: 993 Bytes

Contents

require "helper"

module Neovim
  RSpec.describe API do
    describe ".null" do
      it "returns an empty API object" do
        api = API.null

        expect(api.types).to eq([])
        expect(api.functions).to eq([])
      end
    end

    describe "#function" do
      it "returns a corresponding Function object" do
        api = API.new(
          [nil, {"functions" => [
            {"name" => "vim_strwidth", "async" => false}
          ]}]
        )

        function = api.function("vim_strwidth")
        expect(function).to be_a(API::Function)
        expect(function.name).to eq("vim_strwidth")
        expect(function.async).to be(false)
      end
    end

    describe "#functions_with_prefix" do
      it "returns relevant functions" do
        api = API.new(
          [nil, {"functions" => [{"name" => "vim_strwidth"}]}]
        )

        functions = api.functions_with_prefix("vim_")
        expect(functions.first.name).to eq("vim_strwidth")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
neovim-0.2.4 spec/neovim/api_spec.rb
neovim-0.2.3 spec/neovim/api_spec.rb
neovim-0.2.2 spec/neovim/api_spec.rb
neovim-0.2.1 spec/neovim/api_spec.rb
neovim-0.2.0 spec/neovim/api_spec.rb
neovim-0.1.0 spec/neovim/api_spec.rb
neovim-0.0.6 spec/neovim/api_spec.rb