mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move abstract #match?, #message, and #negated_message to base class
This commit is contained in:
parent
a633d41fae
commit
5ac9020f25
3 changed files with 12 additions and 23 deletions
|
@ -5,16 +5,5 @@ module Spectator::Matchers
|
||||||
# Sub-types must implement `#match?`, `#message`, and `#negated_message`.
|
# Sub-types must implement `#match?`, `#message`, and `#negated_message`.
|
||||||
# Those methods accept a `ValueExpectationPartial` to work with.
|
# Those methods accept a `ValueExpectationPartial` to work with.
|
||||||
abstract struct ConditionMatcher < Matcher
|
abstract struct ConditionMatcher < Matcher
|
||||||
# Determines whether the matcher is satisfied with the value given to it.
|
|
||||||
# True is returned if the matcher is satisfied, false otherwise.
|
|
||||||
abstract def match?(partial) : Bool
|
|
||||||
|
|
||||||
# Describes the condition that satisfies the matcher.
|
|
||||||
# This is informational and displayed to the end-user.
|
|
||||||
abstract def message(partial) : String
|
|
||||||
|
|
||||||
# Describes the condition that won't satsify the matcher.
|
|
||||||
# This is informational and displayed to the end-user.
|
|
||||||
abstract def negated_message(partial) : String
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,5 +11,17 @@ module Spectator::Matchers
|
||||||
# Creates the base of the matcher.
|
# Creates the base of the matcher.
|
||||||
private def initialize(@label)
|
private def initialize(@label)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Determines whether the matcher is satisfied with the value given to it.
|
||||||
|
# True is returned if the match was successful, false otherwise.
|
||||||
|
abstract def match?(partial) : Bool
|
||||||
|
|
||||||
|
# Describes the condition that satisfies the matcher.
|
||||||
|
# This is informational and displayed to the end-user.
|
||||||
|
abstract def message(partial) : String
|
||||||
|
|
||||||
|
# Describes the condition that won't satsify the matcher.
|
||||||
|
# This is informational and displayed to the end-user.
|
||||||
|
abstract def negated_message(partial) : String
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,17 +23,5 @@ module Spectator::Matchers
|
||||||
def initialize(@expected : ExpectedType)
|
def initialize(@expected : ExpectedType)
|
||||||
super(@expected.to_s)
|
super(@expected.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determines whether the matcher is satisfied with the value given to it.
|
|
||||||
# True is returned if the matcher is satisfied, false otherwise.
|
|
||||||
abstract def match?(partial) : Bool
|
|
||||||
|
|
||||||
# Describes the condition that satisfies the matcher.
|
|
||||||
# This is informational and displayed to the end-user.
|
|
||||||
abstract def message(partial) : String
|
|
||||||
|
|
||||||
# Describes the condition that won't satsify the matcher.
|
|
||||||
# This is informational and displayed to the end-user.
|
|
||||||
abstract def negated_message(partial) : String
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue