Sha256: 7145258b4e0c395e8304dfe0b733bc9a928ab7de6a75656960f5c40e08b3d9d0

Contents?: true

Size: 1.79 KB

Versions: 4

Compression:

Stored size: 1.79 KB

Contents

require "helper"

module Neovim
  RSpec.describe API do
    let(:client) { Support.persistent_client }

    let(:api) do
      API.new(
        [
          nil,
          {
            "functions" => [
              {"name" => "nvim_func"},
              {"name" => "nvim_buf_func"},
              {"name" => "nvim_win_func"},
              {"name" => "nvim_tabpage_func"}
            ]
          }
        ]
      )
    end

    describe "#functions_for_object_method" do
      it "returns relevant functions" do
        function = api.function_for_object_method(client, :func)
        expect(function.name).to eq("nvim_func")

        function = api.function_for_object_method(client.get_current_buf, :func)
        expect(function.name).to eq("nvim_buf_func")

        function = api.function_for_object_method(client.get_current_win, :func)
        expect(function.name).to eq("nvim_win_func")

        function = api.function_for_object_method(client.get_current_tabpage, :func)
        expect(function.name).to eq("nvim_tabpage_func")
      end
    end

    describe "#functions_for_object" do
      it "returns relevant functions" do
        functions = api.functions_for_object(client)
        expect(functions.size).to be(1)
        expect(functions.first.name).to eq("nvim_func")

        functions = api.functions_for_object(client.get_current_buf)
        expect(functions.size).to be(1)
        expect(functions.first.name).to eq("nvim_buf_func")

        functions = api.functions_for_object(client.get_current_win)
        expect(functions.size).to be(1)
        expect(functions.first.name).to eq("nvim_win_func")

        functions = api.functions_for_object(client.get_current_tabpage)
        expect(functions.size).to be(1)
        expect(functions.first.name).to eq("nvim_tabpage_func")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neovim-0.10.0 spec/neovim/api_spec.rb
neovim-0.9.1 spec/neovim/api_spec.rb
neovim-0.9.0 spec/neovim/api_spec.rb
neovim-0.9.0.pre.1 spec/neovim/api_spec.rb