Install selected modules
This commit is contained in:
36
spec/installModules_spec.sh
Normal file
36
spec/installModules_spec.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
Describe 'installModules'
|
||||
Include ./install.sh
|
||||
output=()
|
||||
runModule() { output=("$@") }
|
||||
|
||||
It 'does nothing if modules array is empty'
|
||||
declare -A modulesToInstall=() answers=()
|
||||
called=false
|
||||
generateModuleOptions() { called=true }
|
||||
When call installModules
|
||||
The output should eq ''
|
||||
The variable 'called' should eq 'false'
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'calls the module without options if answers is empty'
|
||||
declare -A answers=()
|
||||
modulesToInstall=('/modules/my module')
|
||||
When call installModules
|
||||
The output should eq ''
|
||||
The variable 'output[1]' should eq '/modules/my module'
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'calls the module with given answers as options'
|
||||
declare -A answers=('/modules/my module_name' 'hercules')
|
||||
modulesToInstall=('/modules/my module')
|
||||
When call installModules
|
||||
The output should eq ''
|
||||
The variable 'output' should eq '/modules/my module --name hercules'
|
||||
The variable 'output[1]' should eq '/modules/my module'
|
||||
The variable 'output[2]' should eq '--name'
|
||||
The variable 'output[3]' should eq 'hercules'
|
||||
The status should be success
|
||||
End
|
||||
End
|
||||
Reference in New Issue
Block a user