mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
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:
parent
2da1f9dbbf
commit
e87314be58
1 changed files with 4 additions and 4 deletions
|
@ -502,8 +502,8 @@ module Spectator::DSL
|
||||||
# hash = {"foo" => "bar"}
|
# hash = {"foo" => "bar"}
|
||||||
# expect_raises(KeyError) { hash["baz"] }.to raise_error(KeyError)
|
# expect_raises(KeyError) { hash["baz"] }.to raise_error(KeyError)
|
||||||
# ```
|
# ```
|
||||||
macro expect_raises(type)
|
macro expect_raises(type, &block)
|
||||||
expect {{yield}}.to raise_error({{type}})
|
expect {{block}}.to raise_error({{type}})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Indicates that some block should raise an error with a given message and type.
|
# 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(KeyError, /baz/) { hash["baz"] }
|
||||||
# expect_raises(ArgumentError, "foobar") { raise ArgumentError.new("foobar") }
|
# expect_raises(ArgumentError, "foobar") { raise ArgumentError.new("foobar") }
|
||||||
# ```
|
# ```
|
||||||
macro expect_raises(type, message)
|
macro expect_raises(type, message, &block)
|
||||||
expect {{yield}}.to raise_error({{type}}, {{message}})
|
expect {{block}}.to raise_error({{type}}, {{message}})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used to create predicate matchers.
|
# Used to create predicate matchers.
|
||||||
|
|
Loading…
Reference in a new issue