File: extensions_spec.rb

package info (click to toggle)
ruby-tty-which 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 196 kB
  • sloc: ruby: 274; makefile: 4
file content (16 lines) | stat: -rw-r--r-- 494 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

RSpec.describe TTY::Which, "#extensions" do
  it "provides extensions" do
    exts = [".COM", ".EXE", ".BAT", ".CMD", ".VBS", ".RB", ".RBW"]
    exts_path = exts.join(::File::PATH_SEPARATOR)
    allow(ENV).to receive(:[]).with("PATHEXT").and_return(exts_path)

    expect(TTY::Which.extensions).to eq(exts)
  end

  it "finds no extensions" do
    allow(ENV).to receive(:[]).with("PATHEXT").and_return(nil)
    expect(TTY::Which.extensions).to eq([""])
  end
end