mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 21:27:11 -07:00
Migrate PATH zombie test to Cucumber.
This commit is contained in:
parent
0a948c81c1
commit
42aff3b4c5
5 changed files with 27 additions and 15 deletions
|
@ -14,6 +14,22 @@ Given(/^candidate (\w+) is installed$/) do |candidate|
|
|||
run_bash_command("sdk install #{candidate}") unless installed?(candidate)
|
||||
end
|
||||
|
||||
def _uninstall_candidate_version(candidate_dir)
|
||||
%r{/([^/]+)/([^/]+)$}.match(candidate_dir) do |match|
|
||||
candidate = match[1]
|
||||
version = match[2]
|
||||
run_bash_command("sdk rm #{candidate} #{version}") unless version == 'current'
|
||||
end
|
||||
end
|
||||
|
||||
When(/^candidate (\w+) is uninstalled$/) do |candidate|
|
||||
puts `ls ~/.sdkman/candidates/#{candidate}`
|
||||
Dir["#{ENV['HOME']}/.sdkman/candidates/#{candidate}/*"].each do |candidate_dir|
|
||||
_uninstall_candidate_version(candidate_dir)
|
||||
end
|
||||
puts `ls ~/.sdkman/candidates/#{candidate}`
|
||||
end
|
||||
|
||||
# Uninstall all SDKMAN! candidates
|
||||
# TODO: Run after every scenario, this makes tests very slow.
|
||||
# Currently, Cucumber doesn't have Feature-level hooks, so we have to work around:
|
||||
|
@ -22,10 +38,6 @@ end
|
|||
# --> clean up after _all_ features at least
|
||||
at_exit do
|
||||
Dir["#{ENV['HOME']}/.sdkman/candidates/*/*"].each do |candidate_dir|
|
||||
%r{/([^/]+)/([^/]+)$}.match(candidate_dir) do |match|
|
||||
candidate = match[1]
|
||||
version = match[2]
|
||||
run_bash_command("sdk rm #{candidate} #{version}") unless version == 'current'
|
||||
end
|
||||
_uninstall_candidate_version(candidate_dir)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue