Skip to content

Instantly share code, notes, and snippets.

@garybernhardt
Created February 22, 2010 22:41
Show Gist options
  • Save garybernhardt/311602 to your computer and use it in GitHub Desktop.
Save garybernhardt/311602 to your computer and use it in GitHub Desktop.
# One extra keyword needed for an RSpec clone. Just sayin.
describe('integers') do:
it('can be added') do:
expect(1 + 1) == 2
it('can be subtracted') do:
expect(2 - 1) == 1
it('truncates on division') do:
expect(3 / 2) == 1
# Implement blocks with plain old generators:
def describe(description):
... set stuff up
yield
... tear stuff down
# Required semantic change: when a generator is called with a block included,
# "yield" always calls directly into that block instead of suspending the
# generator.
# Good idea? Maybe...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment