Sha256: 3546de0eeea8531ed63ba2bb6508444eed4b10a8bd87bb0dd019c0050401f26f

Contents?: true

Size: 1.92 KB

Versions: 5

Compression:

Stored size: 1.92 KB

Contents

require "neovim/client_info"
require "neovim/host"
require "neovim/plugin"

module Neovim
  RSpec.describe ClientInfo do
    describe "#to_args" do
      context ".for_host" do
        it "returns script-host info" do
          plugin = double(Plugin, script_host?: true)
          host = double(Host, plugins: [plugin])
          info = ClientInfo.for_host(host)

          expect(info.to_args).to match(
            [
              "ruby-script-host",
              {
                "major" => duck_type(:to_int),
                "minor" => duck_type(:to_int),
                "patch" => duck_type(:to_int)
              },
              :host,
              {
                poll: {},
                specs: {nargs: 1}
              },
              duck_type(:to_hash)
            ]
          )
        end

        it "returns rplugin info" do
          plugin = double(Plugin, script_host?: false)
          host = double(Host, plugins: [plugin])
          info = ClientInfo.for_host(host)

          expect(info.to_args).to match(
            [
              "ruby-rplugin-host",
              {
                "major" => duck_type(:to_int),
                "minor" => duck_type(:to_int),
                "patch" => duck_type(:to_int)
              },
              :host,
              {
                poll: {},
                specs: {nargs: 1}
              },
              duck_type(:to_hash)
            ]
          )
        end
      end

      context ".for_client" do
        it "returns remote client info" do
          info = ClientInfo.for_client

          expect(info.to_args).to match(
            [
              "ruby-client",
              {
                "major" => duck_type(:to_int),
                "minor" => duck_type(:to_int),
                "patch" => duck_type(:to_int)
              },
              :remote,
              {},
              duck_type(:to_hash)
            ]
          )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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