Last active
August 29, 2015 13:57
-
-
Save cronin101/9529205 to your computer and use it in GitHub Desktop.
Test Driven Definition: Behaviour assertions in decorators example.
This file contains hidden or 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
| def must_contain_plus meth | |
| raise unless RubyVM::InstructionSequence.disasm(method(meth)).include? 'opt_plus' | |
| meth | |
| end | |
| must_contain_plus( | |
| def add(x, y) | |
| x + y | |
| end) | |
| #=> :add | |
| must_contain_plus( | |
| def mult(x, y) | |
| x * y | |
| end) | |
| #=> RuntimeError: | |
| # from (pry):21:in `must_contain_plus' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment