class Bounded
Represents a bounded range check.
Definitions
def initialize(range)
Initialize a new bounded predicate.
Signature
-
parameter
rangeRange The range to check against.
Implementation
def initialize(range)
@range = range
end
def print(output)
Print a representation of this predicate.
Signature
-
parameter
outputOutput The output target.
Implementation
def print(output)
output.write("be within ", :variable, @range, :reset)
end
def call(assertions, subject)
Evaluate this predicate against a subject.
Signature
-
parameter
assertionsAssertions The assertions instance to use.
-
parameter
subjectObject The subject to evaluate.
Implementation
def call(assertions, subject)
assertions.nested(self) do |assertions|
assertions.assert(@range.include?(subject))
end
end