mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-24 21:07:11 -07:00
feat(test): Adopt BeforeAll
and AfterAll
This commit is contained in:
parent
9bc7a83802
commit
146dc05e37
5 changed files with 8 additions and 20 deletions
|
@ -3,8 +3,7 @@ Feature: Support autoenv setting
|
|||
candidates specified in `./.sdkmanrc`, if any.
|
||||
|
||||
Background:
|
||||
Given SDKMAN! candidate list is up to date
|
||||
And candidate ant is installed at version 1.9.7
|
||||
Given candidate ant is installed at version 1.9.7
|
||||
And candidate ant is installed at version 1.9.9
|
||||
And candidate ant is installed at version 1.10.1
|
||||
And candidate kscript is installed at version 1.5.0
|
||||
|
|
|
@ -2,8 +2,7 @@ Feature: Shell Completion
|
|||
We want to get the correct completion on the CLI.
|
||||
|
||||
Background:
|
||||
Given SDKMAN! candidate list is up to date
|
||||
And candidate ant is installed at version 1.9.9
|
||||
Given candidate ant is installed at version 1.9.9
|
||||
And candidate ant is installed at version 1.10.1
|
||||
And candidate kscript is installed
|
||||
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
require 'fileutils'
|
||||
require 'tempfile'
|
||||
|
||||
$index_updated = false # TODO: Hack since Cucumber doesn't have Feature-level hooks
|
||||
Given(/^SDKMAN! candidate list is up to date$/) do
|
||||
unless $index_updated
|
||||
run_bash_command('sdk update')
|
||||
$index_updated = true
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^candidate (\w+) is installed at version (\d+(?:\.\d+)*)$/) do |candidate, version|
|
||||
# TODO: Can we mock-install instead?
|
||||
# Something like
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
require_relative '../step_definitions/setup'
|
||||
require_relative '../step_definitions/corner_cases.rb'
|
||||
|
||||
BeforeAll do
|
||||
run_bash_command('sdk update')
|
||||
end
|
||||
|
||||
After do |scenario|
|
||||
_remove_fish_configs
|
||||
_restore_fish_config
|
||||
|
@ -9,12 +13,7 @@ After do |scenario|
|
|||
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:
|
||||
# --> install only if not already installed;
|
||||
# if the test needs a candidate to _not_ be there, make it explicit.
|
||||
# --> clean up after _all_ features at least
|
||||
at_exit do
|
||||
AfterAll do
|
||||
Dir["#{ENV['HOME']}/.sdkman/candidates/*/*"].each do |candidate_dir|
|
||||
_uninstall_candidate_version(candidate_dir)
|
||||
end
|
||||
|
|
|
@ -7,8 +7,7 @@ Feature: Wrapping of Bash
|
|||
We verify equality of (standard) output, exit code, and environment variables.
|
||||
|
||||
Background:
|
||||
Given SDKMAN! candidate list is up to date
|
||||
And candidate ant is installed at version 1.9.9
|
||||
Given candidate ant is installed at version 1.9.9
|
||||
And candidate ant is installed at version 1.10.1
|
||||
And file /tmp/env-test/.sdkmanrc exists with content
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue