Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesob committed Feb 16, 2016
1 parent bff5352 commit 67f60a5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -15,7 +15,7 @@ ADD examples examples
RUN mkdir -p .config/fish && touch .config/fish/config.fish

# Set up test Deskfile
RUN mkdir -p example-project && cp examples/python_project.sh example-project/Deskfile
RUN mkdir -p example-project && cp examples/hello.sh example-project/Deskfile

RUN chown -R $USERNAME:$USERNAME .zshrc example-project examples run_tests.fish run_tests.sh .bashrc .config

Expand Down
6 changes: 2 additions & 4 deletions desk
Expand Up @@ -102,7 +102,7 @@ cmd_go() {
#
local TODESK="$1"
local DESKEXT=$(get_deskfile_extension)
local DESKPATH="$(find "${DESKS}/" -name "${TODESK}${DESKEXT}")"
local DESKPATH="$(find "${DESKS}/" -name "${TODESK}${DESKEXT}" 2>/dev/null)"

local POSSIBLE_DESKFILE_DIR="${TODESK%$DESKFILE_NAME}"
if [ -z "$POSSIBLE_DESKFILE_DIR" ]; then
Expand All @@ -119,7 +119,7 @@ cmd_go() {

local REALPATH=$( cd $POSSIBLE_DESKFILE_DIR && pwd )
DESKPATH="${REALPATH}/${DESKFILE_NAME}"
TODESK="$(basename $REALPATH)"
TODESK=$(basename "$REALPATH")
fi

# Shift desk name so we can forward on all arguments to the shell.
Expand Down Expand Up @@ -193,8 +193,6 @@ cmd_current() {
fi

local DESKPATH=$DESK_ENV
local DESK_NAME=${DESKPATH##*/}
local DESK_NAME=${DESK_NAME%.*}
local CALLABLES=$(get_callables "$DESKPATH")
local AUTO_ALIGN len longest out

Expand Down
28 changes: 14 additions & 14 deletions test/run_tests.sh
Expand Up @@ -132,30 +132,30 @@ ensure $? "Run in desk 'hello' didn't work with hi function"
## `desk go`

RAN=$(desk go example-project/Deskfile -c 'desk ; exit')
echo "$RAN" | grep "python_project - desk for working on a Python project" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/Deskfile)"
echo "$RAN" | grep -E "req\s+Install requirements" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/Deskfile)"
echo "$RAN" | grep -E "t\s+Run unittests with nose" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/Deskfile)"
echo "$RAN" | grep "example-project - simple desk that says hello" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"
echo "$RAN" | grep -E "hi\s+" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"
echo "$RAN" | grep -E "howdy\s+" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"

RAN=$(desk go example-project/ -c 'desk ; exit')
echo "$RAN" | grep "python_project - desk for working on a Python project" >/dev/null
echo "$RAN" | grep "example-project - simple desk that says hello" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"
echo "$RAN" | grep -E "req\s+Install requirements" >/dev/null
echo "$RAN" | grep -E "hi\s+" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"
echo "$RAN" | grep -E "t\s+Run unittests with nose" >/dev/null
echo "$RAN" | grep -E "howdy\s+" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"

pushd example-project

RAN=$(desk go . -c 'desk ; exit')
echo "$RAN" | grep "python_project - desk for working on a Python project" >/dev/null
ensure $? "Deskfile invocation didn't work (./)"
echo "$RAN" | grep -E "req\s+Install requirements" >/dev/null
ensure $? "Deskfile invocation didn't work (./)"
echo "$RAN" | grep -E "t\s+Run unittests with nose" >/dev/null
echo "$RAN" | grep "example-project - simple desk that says hello" >/dev/null
ensure $? "Deskfile invocation didn't work (./)"
echo "$RAN" | grep -E "hi\s+" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"
echo "$RAN" | grep -E "howdy\s+" >/dev/null
ensure $? "Deskfile invocation didn't work (example-project/)"

popd

Expand Down

0 comments on commit 67f60a5

Please sign in to comment.