Skip to content

Instantly share code, notes, and snippets.

@kidach1
Created June 27, 2014 02:11
Show Gist options
  • Save kidach1/d0d7265125c75dabab43 to your computer and use it in GitHub Desktop.
Save kidach1/d0d7265125c75dabab43 to your computer and use it in GitHub Desktop.
[Ruby] RSpecのexpectを読んでいたら ref: http://qiita.com/kidachi_/items/a0417ba68ce38382f68d
def expect(*target, &target_block)
raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1
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