Skip to content

Instantly share code, notes, and snippets.

@nahi
Created February 8, 2012 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nahi/1767002 to your computer and use it in GitHub Desktop.
Save nahi/1767002 to your computer and use it in GitHub Desktop.
def expect
begin
yield
rescue Exception => excn
o = Struct.new(:excn).new(excn)
def o.to(arg)
arg.call(excn)
end
o
end
end
def something
raise
end
def raise_error(expected)
Proc.new { |actual|
yield [expected, actual]
}
end
expect { something }.to raise_error(NotImplementedError) { |e| p e }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment