mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Don't stub all Pathname
s in tests.
This commit is contained in:
parent
27189f4aba
commit
3472362ddd
@ -129,16 +129,16 @@ class Caveats
|
||||
Bash completion has been installed to:
|
||||
#{root_dir}/etc/bash_completion.d
|
||||
EOS
|
||||
when :zsh
|
||||
<<~EOS
|
||||
zsh #{installed.join(" and ")} have been installed to:
|
||||
#{root_dir}/share/zsh/site-functions
|
||||
EOS
|
||||
when :fish
|
||||
fish_caveats = +"fish #{installed.join(" and ")} have been installed to:"
|
||||
fish_caveats << "\n #{root_dir}/share/fish/vendor_completions.d" if completion_installed
|
||||
fish_caveats << "\n #{root_dir}/share/fish/vendor_functions.d" if functions_installed
|
||||
fish_caveats.freeze
|
||||
when :zsh
|
||||
<<~EOS
|
||||
zsh #{installed.join(" and ")} have been installed to:
|
||||
#{root_dir}/share/zsh/site-functions
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -335,10 +335,10 @@ class Keg
|
||||
def completion_installed?(shell)
|
||||
dir = case shell
|
||||
when :bash then path/"etc/bash_completion.d"
|
||||
when :fish then path/"share/fish/vendor_completions.d"
|
||||
when :zsh
|
||||
dir = path/"share/zsh/site-functions"
|
||||
dir if dir.directory? && dir.children.any? { |f| f.basename.to_s.start_with?("_") }
|
||||
when :fish then path/"share/fish/vendor_completions.d"
|
||||
end
|
||||
dir&.directory? && !dir.children.empty?
|
||||
end
|
||||
|
@ -301,29 +301,35 @@ describe Caveats do
|
||||
let(:caveats) { described_class.new(f).caveats }
|
||||
let(:path) { f.prefix.resolved_path }
|
||||
|
||||
let(:bash_completion_dir) { path/"etc/bash_completion.d" }
|
||||
let(:fish_vendor_completions) { path/"share/fish/vendor_completions.d" }
|
||||
let(:zsh_site_functions) { path/"share/zsh/site-functions" }
|
||||
|
||||
before do
|
||||
# don't try to load/fetch gcc/glibc
|
||||
allow(DevelopmentTools).to receive_messages(needs_libc_formula?: false, needs_compiler_formula?: false)
|
||||
|
||||
allow_any_instance_of(Pathname).to receive(:children).and_return([Pathname.new("child")])
|
||||
allow_any_instance_of(Object).to receive(:which).with(any_args).and_return(Pathname.new("shell"))
|
||||
allow(Utils::Shell).to receive_messages(preferred: nil, parent: nil)
|
||||
end
|
||||
|
||||
it "gives dir where Bash completions have been installed" do
|
||||
(path/"etc/bash_completion.d").mkpath
|
||||
it "includes where Bash completions have been installed to" do
|
||||
bash_completion_dir.mkpath
|
||||
FileUtils.touch bash_completion_dir/f.name
|
||||
expect(caveats).to include(HOMEBREW_PREFIX/"etc/bash_completion.d")
|
||||
end
|
||||
|
||||
it "gives dir where zsh completions have been installed" do
|
||||
(path/"share/zsh/site-functions").mkpath
|
||||
expect(caveats).to include(HOMEBREW_PREFIX/"share/zsh/site-functions")
|
||||
end
|
||||
|
||||
it "gives dir where fish completions have been installed" do
|
||||
(path/"share/fish/vendor_completions.d").mkpath
|
||||
it "includes where fish completions have been installed to" do
|
||||
fish_vendor_completions.mkpath
|
||||
FileUtils.touch fish_vendor_completions/f.name
|
||||
expect(caveats).to include(HOMEBREW_PREFIX/"share/fish/vendor_completions.d")
|
||||
end
|
||||
|
||||
it "includes where zsh completions have been installed to" do
|
||||
zsh_site_functions.mkpath
|
||||
FileUtils.touch zsh_site_functions/f.name
|
||||
expect(caveats).to include(HOMEBREW_PREFIX/"share/zsh/site-functions")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user