mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Use reference matching for be()
This commit is contained in:
parent
f53bc26c28
commit
2378594c5d
1 changed files with 7 additions and 7 deletions
|
@ -47,18 +47,18 @@ module Spectator::DSL
|
||||||
::Spectator::Matchers::TruthyMatcher.new(true)
|
::Spectator::Matchers::TruthyMatcher.new(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Indicates that some value should semantically equal another.
|
# Indicates that some object should be the same as another.
|
||||||
# The === operator is used for this check.
|
# This checks if two references are the same.
|
||||||
# This has identical behavior as a "when" condition in a case block.
|
# The `Reference#same?` method is used for this check.
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
# ```
|
# ```
|
||||||
# expect(1 + 2).to be(3)
|
# obj = "foobar"
|
||||||
# expect(5).to be(Int32) # Using `#be_a` instead is recommened here.
|
# expect(obj).to be(obj)
|
||||||
# expect(tuple).to be({1, 2})
|
# expect(obj.dup).to_not be(obj)
|
||||||
# ```
|
# ```
|
||||||
macro be(expected)
|
macro be(expected)
|
||||||
::Spectator::Matchers::CaseMatcher.new({{expected}}, {{expected.stringify}})
|
::Spectator::Matchers::ReferenceMatcher.new({{expected}}, {{expected.stringify}})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Indicates that some value should be of a specified type.
|
# Indicates that some value should be of a specified type.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue