Last active
August 29, 2015 14:06
-
-
Save oreshinya/ce930c38d0221e5ea021 to your computer and use it in GitHub Desktop.
power_assert extension for rspec sample.
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
| require 'rspec/core' | |
| require 'power_assert' | |
| module PowerAssertExtension | |
| def power_assert(&block) | |
| ::PowerAssert.start(block, assertion_method: __method__) do |pa| | |
| return if pa.yield | |
| message = "\n#{pa.message_proc.call}" | |
| raise RSpec::Expectations::ExpectationNotMetError.new(message) | |
| end | |
| end | |
| end | |
| class RSpec::Core::ExampleGroup | |
| include PowerAssertExtension | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: