Created
June 27, 2014 02:11
-
-
Save kidach1/d0d7265125c75dabab43 to your computer and use it in GitHub Desktop.
[Ruby] RSpecのexpectを読んでいたら ref: http://qiita.com/kidachi_/items/a0417ba68ce38382f68d
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
def expect(*target, &target_block) |
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
raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1 |
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
def expect(*target, &target_block) | |
target << target_block if block_given? | |
raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1 | |
::RSpec::Expectations::ExpectationTarget.new(target.first) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment