File: exist_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 (17 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

RSpec.describe TTY::Which, "#exist?" do
  it "finds executable in the path" do
    allow(TTY::Which).to receive(:which).with("ruby", a_hash_including(:paths))
                                        .and_return("/usr/loca/bin/ruby")

    expect(TTY::Which.exist?("ruby")).to be(true)
  end

  it "fails to find executable in the path" do
    allow(TTY::Which).to receive(:which).with("ruby", a_hash_including(:paths))
                                        .and_return(nil)

    expect(TTY::Which.exist?("ruby")).to be(false)
  end
end