Skip to content

Instantly share code, notes, and snippets.

@vinbarnes
Created July 16, 2009 14:41
Show Gist options
  • Select an option

  • Save vinbarnes/148442 to your computer and use it in GitHub Desktop.

Select an option

Save vinbarnes/148442 to your computer and use it in GitHub Desktop.
module TestCaseExtensions
def should(testname, &block)
unless block_given?
pending = 'PENDING '
block = lambda {}
end
testname = "test #{pending}#{@focus}should #{testname}".gsub(/\s(no|not)\s/i, ' *\1* ')
define_method(testname, block)
end
def focus(object)
return unless block_given?
@focus = object.to_s + ' '
yield
@focus = nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment