Created
February 17, 2016 04:12
-
-
Save kigster/89044c312ed94115a1d9 to your computer and use it in GitHub Desktop.
Cool way to provide a long multi-line description for an Exception
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
# taken from rspec-core's file pending.rb | |
if block_given? | |
raise ArgumentError, <<-EOS.gsub(/^\s+\|/, '') | |
|The semantics of `RSpec::Core::Pending#pending` have changed in | |
|RSpec 3. In RSpec 2.x, it caused the example to be skipped. In | |
|RSpec 3, the rest of the example is still run but is expected to | |
|fail, and will be marked as a failure (rather than as pending) if | |
|the example passes. | |
| | |
|Passing a block within an example is now deprecated. Marking the | |
|example as pending provides the same behavior in RSpec 3 which was | |
|provided only by the block in RSpec 2.x. | |
| | |
|Move the code in the block provided to `pending` into the rest of | |
|the example body. | |
| | |
|Called from #{CallerFilter.first_non_rspec_line}. | |
| | |
EOS | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment