Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Some code from jeremymcanally's "pending" | ||
# http://github.com/jeremymcanally/pending/tree/master | ||
|
||
module ActiveSupport | ||
module Testing | ||
module Pending | ||
|
||
@@pending_cases = [] | ||
@@at_exit = false | ||
|
||
def pending(description = "", &block) | ||
if block_given? | ||
failed = false | ||
|
||
begin | ||
block.call | ||
rescue | ||
failed = true | ||
end | ||
|
||
flunk("<#{description}> did not fail.") unless failed | ||
end | ||
|
||
caller[0] =~ (/(.*):(.*):in `(.*)'/) | ||
@@pending_cases << "#{$3} at #{$1}, line #{$2}" | ||
print "P" | ||
|
||
@@at_exit ||= begin | ||
at_exit do | ||
puts "\nPending Cases:" | ||
@@pending_cases.each do |test_case| | ||
puts test_case | ||
end | ||
end | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
ff68430
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
ff68430
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ha! I was worried my tweet was premature and it was hidden in some other src :)