Permalink
Browse files

Fix tests with new executable shpec

  • Loading branch information...
1 parent 519d491 commit dcf3de2944e242bbb049ee6846c95ab7ec145c9c @rylnd committed Feb 1, 2013
Showing with 15 additions and 34 deletions.
  1. +1 −1 .travis.yml
  2. +1 −8 shpec/etc/failing_example
  3. +1 −8 shpec/etc/passing_example
  4. +12 −17 shpec/shpec_shpec
View
@@ -1,2 +1,2 @@
language: c
-script: shpec/runner
+script: bin/shpec
View
9 shpec/etc/failing_example 100755 → 100644
@@ -1,10 +1,3 @@
-#!/usr/bin/env bash
-
-## SETUP
-spec_root=$(dirname ${BASH_SOURCE[0]})
-source $spec_root/../../lib/shpec
-
describe "a failing test"
- it "fails"
- assert equal "foo" "bar"
+ assert equal "foo" "bar"
end_describe
View
9 shpec/etc/passing_example 100755 → 100644
@@ -1,10 +1,3 @@
-#!/usr/bin/env bash
-
-## SETUP
-spec_root=$(dirname ${BASH_SOURCE[0]})
-source $spec_root/../../lib/shpec
-
describe "a passing test"
- it "passes"
- assert equal "foo" "foo"
+ assert equal "foo" "foo"
end_describe
View
@@ -1,9 +1,3 @@
-#!/usr/bin/env bash
-
-## SETUP
-shpec_root=$(dirname ${BASH_SOURCE[0]})
-source $shpec_root/../lib/shpec
-
describe "shpec"
describe "basic operations"
it "asserts equality"
@@ -40,22 +34,23 @@ describe "shpec"
end_describe
describe "exit codes"
- it "returns nonzero if any test fails"
- ./$shpec_root/etc/failing_example &> /dev/null
- assert true "[[ $? -ne 0 ]]"
-
- it "returns zero if a suite passes"
- ./$shpec_root/etc/passing_example &> /dev/null
- assert true "[[ $? -eq 0 ]]"
+ it "sets the failure flag if any test fails"
+ . $shpec_root/etc/failing_example &> /dev/null
+ assert true "[[ -n "$fail" ]]"
+ fail=""
+
+ it "doesn't set the flag if a suite passes"
+ . $shpec_root/etc/passing_example &> /dev/null
+ assert blank "$fail"
end_describe
describe "output"
it "outputs passing tests to STDOUT"
- message=$(./$shpec_root/etc/passing_example)
- assert match "$message" "passes"
+ message="$(. $shpec_root/etc/passing_example)"
+ assert match "$message" "a\ passing\ test"
it "outputs failing tests to STDERR"
- message=$(./$shpec_root/etc/failing_example 2>&1)
- assert match "$message" "fails"
+ message="$(. $shpec_root/etc/failing_example 2>&1)"
+ assert match "$message" "a\ failing\ test"
end_describe
end_describe

0 comments on commit dcf3de2

Please sign in to comment.