Permalink
Browse files

add explicit pending

  • Loading branch information...
1 parent 9893521 commit 1c70f2ea1f439e5b81e46aa0913a8da02a82cbf0 @geemus geemus committed Oct 13, 2010
Showing with 15 additions and 3 deletions.
  1. +11 −1 lib/shindo.rb
  2. +2 −1 tests/bin_tests.rb
  3. +2 −1 tests/data/pending
View
12 lib/shindo.rb
@@ -46,6 +46,13 @@ def before(&block)
@befores.last.push(block)
end
+ def pending
+ catch(:pending) do
+ @pending = true
+ end
+ throw(:pending)
+ end
+
def tests(description, tags = [], &block)
return self if Thread.main[:exit] || Thread.current[:reload]
@@ -123,7 +130,10 @@ def assert(type, expectation, description, &block)
success = false
value = error
end
- if success
+ if @pending
+ display_pending(description)
+ @pending = false
+ elsif success
display_success(description)
else
display_failure(description)
View
3 tests/bin_tests.rb
@@ -14,7 +14,8 @@
tests('pending') do
@output = bin(path('pending'))
- includes('# pending') { @output }
+ includes('# implicit pending') { @output }
+ includes('# explicit pending') { @output }
tests('$?.exitstatus').returns(0) { $?.exitstatus }
end
View
3 tests/data/pending
@@ -1,3 +1,4 @@
Shindo.tests do
- test('pending')
+ test('implicit pending')
+ test('explicit pending') { pending }
end

0 comments on commit 1c70f2e

Please sign in to comment.