ruby/gems/2.1.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/syntax.rb
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
定義部分だけ見ると
def expect(*target, &target_block)
targetを配列として受け取り(*target)、かつblockも渡せる構造と思いきや、
raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1
結局target.size == 1
以外はエラーを吐く。
例外メッセージを明示的に設定したかったから?
こんな書き方もあるのかと勉強になりました。