mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove unecessary type restrictions
This commit is contained in:
parent
a53bafe333
commit
e2779822b5
14 changed files with 41 additions and 41 deletions
|
@ -30,12 +30,12 @@ module Spectator::Expectations
|
|||
end
|
||||
|
||||
# Describes the condition that must be met for the expectation to be satisifed.
|
||||
private def message : String
|
||||
private def message
|
||||
@matcher.message(@partial)
|
||||
end
|
||||
|
||||
# Describes the condition under which the expectation won't be satisifed.
|
||||
private def negated_message : String
|
||||
private def negated_message
|
||||
@matcher.negated_message(@partial)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct CaseMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
expected === partial.actual
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to semantically equal #{label} (using ===)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not semantically equal #{label} (using ===)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,19 +11,19 @@ module Spectator::Matchers
|
|||
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual.empty?
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be empty"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be empty"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct EqualityMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual == expected
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to equal #{label} (using ==)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not equal #{label} (using ==)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct GreaterThanEqualMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual >= expected
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be greater than or equal to #{label} (using >=)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be greater than or equal to #{label} (using >=)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct GreaterThanMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual > expected
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be greater than #{label} (using >)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be greater than #{label} (using >)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct InequalityMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual != expected
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to not equal #{label} (using !=)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to equal #{label} (using !=)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct LessThanEqualMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual <= expected
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be less than or equal to #{label} (using <=)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be less than or equal to #{label} (using <=)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct LessThanMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual < expected
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be less than #{label} (using <)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be less than #{label} (using <)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,19 +11,19 @@ module Spectator::Matchers
|
|||
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual.nil?
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be nil"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be nil"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,19 +8,19 @@ module Spectator::Matchers
|
|||
struct RangeMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
@expected.includes?(partial.actual)
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be in #{label}"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be in #{label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -6,19 +6,19 @@ module Spectator::Matchers
|
|||
struct RegexMatcher(ExpectedType) < ValueMatcher(ExpectedType)
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
!!(partial.actual =~ expected)
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to match #{label} (using =~)"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not match #{label} (using =~)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,20 +18,20 @@ module Spectator::Matchers
|
|||
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
# Cast value to truthy value and compare.
|
||||
@expected == !!partial.actual
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be #{label}"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be #{label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -12,19 +12,19 @@ module Spectator::Matchers
|
|||
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the match was successful, false otherwise.
|
||||
def match?(partial) : Bool
|
||||
def match?(partial)
|
||||
partial.actual.is_a?(Expected)
|
||||
end
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def message(partial) : String
|
||||
def message(partial)
|
||||
"Expected #{partial.label} to be a #{label}"
|
||||
end
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
def negated_message(partial) : String
|
||||
def negated_message(partial)
|
||||
"Expected #{partial.label} to not be a #{label}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue