Skip fish completion tests if fish is not installed

Fixes #1654
This commit is contained in:
Mislav Marohnić 2018-01-22 21:54:04 +01:00
Родитель b35f401a18
Коммит d4e484b251
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -107,6 +107,10 @@ setup_tmp_home = lambda { |shell|
} }
$tmux = nil $tmux = nil
$installed_shells = Hash.new { |cache, shell|
`which #{shell} 2>/dev/null`
cache[shell] = $?.success?
}
Before('@completion') do Before('@completion') do
unless $tmux unless $tmux
@ -126,7 +130,12 @@ World Module.new {
attr_reader :shell attr_reader :shell
def set_shell(shell) def set_shell(shell)
@shell = shell if $installed_shells[shell]
@shell = shell
true
else
false
end
end end
define_method(:tmux_pane) do define_method(:tmux_pane) do
@ -221,7 +230,7 @@ World Module.new {
} }
Given(/^my shell is (\w+)$/) do |shell| Given(/^my shell is (\w+)$/) do |shell|
set_shell(shell) set_shell(shell) || pending
setup_tmp_home.call(shell) setup_tmp_home.call(shell)
end end