testing plugin load from custom folder

This commit is contained in:
Bruno Pinto 2015-01-10 15:09:09 -02:00
parent 75ba7639a9
commit f34f114018
3 changed files with 18 additions and 6 deletions

View File

@ -1,5 +1,7 @@
function run_spec -a test function run_spec -a test
functions -q before_each; and before_each
eval $test eval $test
functions -q after_each; and after_each
end end
function run_spec._.results.assertion_success -e assertion_success function run_spec._.results.assertion_success -e assertion_success

View File

@ -5,7 +5,7 @@ function run_specs
end end
# Run before all block # Run before all block
eval "before_all" functions -q before_all; and before_all
# Run tests # Run tests
for test in (functions -n | grep it_) for test in (functions -n | grep it_)
@ -13,5 +13,5 @@ function run_specs
end end
# Run after all block # Run after all block
eval "after_all" functions -q after_all; and after_all
end end

View File

@ -1,11 +1,13 @@
function describe_oh_my_fish function describe_oh_my_fish
function before_all function before_each
set -g fish_custom_bak $fish_custom set -g fish_custom_bak $fish_custom
set -g fish_function_path_bak $fish_function_path set -g fish_function_path_bak $fish_function_path
set -g fish_plugins_bak $fish_plugins set -g fish_plugins_bak $fish_plugins
set -e fish_custom
end end
function after_all function after_each
set fish_custom $fish_custom_bak set fish_custom $fish_custom_bak
set fish_function_path $fish_function_path_bak set fish_function_path $fish_function_path_bak
set fish_plugins $fish_plugins_bak set fish_plugins $fish_plugins_bak
@ -18,13 +20,13 @@ function describe_oh_my_fish
end end
function it_allows_the_custom_folder_location_to_be_customized function it_allows_the_custom_folder_location_to_be_customized
set fish_custom /tmp set -g fish_custom /tmp
load_oh_my_fish load_oh_my_fish
expect $fish_custom to_equal '/tmp' expect $fish_custom to_equal '/tmp'
end end
function it_loads_all_custom_files function it_loads_all_custom_files
set fish_custom /tmp set -g fish_custom /tmp
echo 'set -gx TEST_LOAD_CUSTOM_FILE file_loaded' > $fish_custom/test.load echo 'set -gx TEST_LOAD_CUSTOM_FILE file_loaded' > $fish_custom/test.load
load_oh_my_fish load_oh_my_fish
@ -48,6 +50,14 @@ function describe_oh_my_fish
expect $fish_function_path to_include $fish_path/plugins/z expect $fish_function_path to_include $fish_path/plugins/z
end end
function it_loads_plugins_from_custom_folder
array.delete "$fish_custom/plugins/example" fish_function_path
set fish_plugins example
load_oh_my_fish
expect $fish_function_path to_include $fish_custom/plugins/example
end
function it_loads_the_selected_theme function it_loads_the_selected_theme
array.delete "$fish_path/themes/l" fish_function_path array.delete "$fish_path/themes/l" fish_function_path