File: executable_spec.rb

package info (click to toggle)
ruby-neovim 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 548 kB
  • sloc: ruby: 4,178; sh: 23; makefile: 4
file content (32 lines) | stat: -rw-r--r-- 849 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require "helper"

module Neovim
  RSpec.describe Executable do
    describe ".from_env" do
      it "respects NVIM_EXECUTABLE" do
        executable = Executable.from_env("NVIM_EXECUTABLE" => "/foo/nvim")
        expect(executable.path).to eq("/foo/nvim")
      end

      it "returns a default path" do
        executable = Executable.from_env({})
        expect(executable.path).to eq("nvim")
      end
    end

    describe "#version" do
      it "returns the current nvim version" do
        executable = Executable.from_env
        expect(executable.version).to match(/^\d+\.\d+\.\d+/)
      end

      it "raises with an invalid executable path" do
        executable = Executable.new(File::NULL)

        expect do
          executable.version
        end.to raise_error(Executable::Error, Regexp.new(File::NULL))
      end
    end
  end
end