diff --git a/test/fixtures/svn/working/svn b/test/fixtures/svn/working/svn index 0fdcf091..5d72d7cd 100755 --- a/test/fixtures/svn/working/svn +++ b/test/fixtures/svn/working/svn @@ -1,3 +1,10 @@ #!/usr/bin/env bash +# If the info command is called +# AND the parent folder contains the .svn folder +# THEN return the current path, similar to what `svn info` does +if [[ "$1" = "info" ]] && [[ -d "../.svn" ]]; then + echo "$PWD" +fi + exit 0 diff --git a/test/themes/base.theme.svn.bats b/test/themes/base.theme.svn.bats index ce199ac1..c358e404 100644 --- a/test/themes/base.theme.svn.bats +++ b/test/themes/base.theme.svn.bats @@ -64,6 +64,43 @@ reset_svn_path() { reset_svn_path } +@test 'themes base: SVN: detect SVN repo even from a subfolder' { + repo="$(setup_repo)" + pushd "$repo" + + mkdir foo + pushd foo + + setup_svn_path "$BASH_IT/test/fixtures/svn/working" + + # Load the base theme again so that the working SVN script is detected + load ../../themes/base.theme + + scm + # Make sure that the SVN command is used + assert_equal "$SCM" "$SCM_SVN" + + reset_svn_path +} + +@test 'themes base: SVN: no SCM if no .svn folder can be found' { + repo="$(setup_repo)" + pushd "$repo" + + rm -rf .svn + + setup_svn_path "$BASH_IT/test/fixtures/svn/working" + + # Load the base theme again so that the working SVN script is detected + load ../../themes/base.theme + + scm + # Make sure that the SVN command is used + assert_equal "$SCM" "$SCM_NONE" + + reset_svn_path +} + @test 'themes base: SVN: ignore SVN repo when using broken SVN command' { repo="$(setup_repo)" pushd "$repo" @@ -79,3 +116,22 @@ reset_svn_path() { reset_svn_path } + +@test 'themes base: SVN: ignore SVN repo even from a subfolder when using a broken SVN' { + repo="$(setup_repo)" + pushd "$repo" + + mkdir foo + pushd foo + + setup_svn_path "$BASH_IT/test/fixtures/svn/broken" + + # Load the base theme again so that the working SVN script is detected + load ../../themes/base.theme + + scm + # Make sure that the SVN command is used + assert_equal "$SCM" "$SCM_NONE" + + reset_svn_path +}