mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add custom messages for matchers
This gives users natural, easier to understand text for expectations.
This commit is contained in:
parent
562b544223
commit
8fb051d61e
2 changed files with 10 additions and 0 deletions
|
@ -10,6 +10,14 @@ module Spectator
|
||||||
def match?(expectation : Expectation)
|
def match?(expectation : Expectation)
|
||||||
expectation.actual == @expected
|
expectation.actual == @expected
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def message(expectation : Expectation) : String
|
||||||
|
"Expected #{expectation.actual} to equal #{@expected} (using ==)"
|
||||||
|
end
|
||||||
|
|
||||||
|
def negated_message(expectation : Expectation) : String
|
||||||
|
"Expected #{expectation.actual} to not equal #{@expected} (using ==)"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,8 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
abstract def match?(expectation : Expectation)
|
abstract def match?(expectation : Expectation)
|
||||||
|
abstract def message(expectation : Expectation) : String
|
||||||
|
abstract def negated_message(expectation : Expectation) : String
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue