mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 21:27:11 -07:00
Migrate completion tests to Cucumber.
Also retire Fish 2.x + macOS test; installation of custom brew didn't work out anymore.
This commit is contained in:
parent
ed6039e533
commit
0c15f199cd
12 changed files with 364 additions and 236 deletions
26
test/features/step_definitions/completion.rb
Normal file
26
test/features/step_definitions/completion.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'open3'
|
||||
|
||||
module CompletionHelper
|
||||
def complete(cmd)
|
||||
completions = run_fish_command("complete -C\"sdk #{cmd}\"")
|
||||
|
||||
completions.split("\n") \
|
||||
.map { |line| line.split(/\s+/)[0].strip } \
|
||||
.sort \
|
||||
.uniq \
|
||||
.join(', ')
|
||||
# TODO: Why do we get duplicates in the Docker container?
|
||||
# --> remove uniq
|
||||
end
|
||||
end
|
||||
World CompletionHelper
|
||||
|
||||
When('the user enters {string} into the prompt') do |cmd|
|
||||
@response = complete(cmd.gsub(/["']/, ''))
|
||||
end
|
||||
|
||||
Then(/^completion should propose "(.*)"$/) do |completions|
|
||||
expect(@response).to eq(completions)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue