mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -07:00
Migrate installer test to Cucumber.
This commit is contained in:
parent
42aff3b4c5
commit
7e97c4c1c1
4 changed files with 34 additions and 7 deletions
|
@ -37,5 +37,3 @@ install:
|
|||
|
||||
script:
|
||||
- (cd test && cucumber)
|
||||
# TODO: Migrate these to Cucumber:
|
||||
- bash test/remove_sdkman.sh > /dev/null && fish -c "echo 'y' | sdk" > /dev/null && fish -c "sdk version"
|
||||
|
|
11
test/features/installer.feature
Normal file
11
test/features/installer.feature
Normal file
|
@ -0,0 +1,11 @@
|
|||
Feature: Install SDKMAN! if necessary
|
||||
|
||||
Scenario:
|
||||
Given SDKMAN! is not installed
|
||||
When sdk is called and user answers "n"
|
||||
Then SDKMAN! is absent
|
||||
|
||||
Scenario:
|
||||
Given SDKMAN! is not installed
|
||||
When sdk is called and user answers "y"
|
||||
Then SDKMAN! is present
|
23
test/features/step_definitions/installer.rb
Normal file
23
test/features/step_definitions/installer.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'fileutils'
|
||||
|
||||
Given(/^SDKMAN! is not installed$/) do
|
||||
FileUtils.rm_rf("#{ENV['HOME']}/.sdkman")
|
||||
end
|
||||
|
||||
When('sdk is called and user answers {string}') do |answer|
|
||||
run_fish_command("echo '#{answer}' | sdk version")
|
||||
end
|
||||
|
||||
Then(/^SDKMAN! is absent$/) do
|
||||
expect(Dir["#{ENV['HOME']}/.sdkman/*"].count).to eq(0)
|
||||
response = run_bash_command("sdk version")
|
||||
expect(response[:status]).to_not eq(0)
|
||||
end
|
||||
|
||||
Then('SDKMAN! is present') do
|
||||
expect(Dir["#{ENV['HOME']}/.sdkman/*"].count).to be > 1
|
||||
response = run_bash_command("sdk version")
|
||||
expect(response[:status]).to eq(0)
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
rm -rf "${HOME}/.sdkman" \
|
||||
&& sed -i'.bak' -E -e 's/^.*(sdkman|SDKMAN).*$//g' "${HOME}/.bashrc" \
|
||||
&& echo 'SDKMAN! uninstalled'
|
Loading…
Add table
Add a link
Reference in a new issue