Use block instead of yield to insert block

The "yield" method produces `begin...end`.
The "block" method produces `do...end`, which is needed for this syntax.
This commit is contained in:
Michael Miller 2019-03-26 21:45:31 -06:00
parent 2da1f9dbbf
commit e87314be58

View file

@ -502,8 +502,8 @@ module Spectator::DSL
# hash = {"foo" => "bar"}
# expect_raises(KeyError) { hash["baz"] }.to raise_error(KeyError)
# ```
macro expect_raises(type)
expect {{yield}}.to raise_error({{type}})
macro expect_raises(type, &block)
expect {{block}}.to raise_error({{type}})
end
# Indicates that some block should raise an error with a given message and type.
@ -517,8 +517,8 @@ module Spectator::DSL
# expect_raises(KeyError, /baz/) { hash["baz"] }
# expect_raises(ArgumentError, "foobar") { raise ArgumentError.new("foobar") }
# ```
macro expect_raises(type, message)
expect {{yield}}.to raise_error({{type}}, {{message}})
macro expect_raises(type, message, &block)
expect {{block}}.to raise_error({{type}}, {{message}})
end
# Used to create predicate matchers.