mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Merge remote-tracking branch 'origin/master' into release/0.9
This commit is contained in:
commit
8c1019753f
63 changed files with 176 additions and 150 deletions
|
@ -14,10 +14,17 @@ before_script:
|
|||
|
||||
spec:
|
||||
script:
|
||||
- crystal spec
|
||||
- crystal spec --error-on-warnings
|
||||
- bin/ameba
|
||||
- crystal tool format --check
|
||||
|
||||
nightly:
|
||||
image: "crystallang/crystal:nightly"
|
||||
allow_failure: true
|
||||
script:
|
||||
- crystal spec --error-on-warnings
|
||||
- crystal tool format --check
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
dependencies:
|
||||
|
|
|
@ -6,7 +6,7 @@ description: |
|
|||
authors:
|
||||
- Michael Miller <icy.arctic.fox@gmail.com>
|
||||
|
||||
crystal: 0.30.1
|
||||
crystal: 0.31.0
|
||||
|
||||
license: MIT
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ describe Spectator::DSL::SampleExampleGroupBuilder do
|
|||
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
|
||||
symbol = :test
|
||||
count = 3
|
||||
expected = Array.new(SAMPLE_VALUES_COLLECTION.size * count) { |i| SAMPLE_VALUES_COLLECTION[i / count] }
|
||||
expected = Array.new(SAMPLE_VALUES_COLLECTION.size * count) { |i| SAMPLE_VALUES_COLLECTION[i // count] }
|
||||
create_proc = ->(s : SampleValueCollection) { s.create }
|
||||
builder = Spectator::DSL::SampleExampleGroupBuilder.new("foobar", SampleValueCollection, create_proc, "value", symbol)
|
||||
count.times { builder.add_child(factory) }
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# Example that always raises an exception.
|
||||
class ErroredExample < Spectator::RunnableExample
|
||||
# Dummy description.
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"ERROR"
|
||||
end
|
||||
|
||||
# Dummy source.
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new(__FILE__, __LINE__)
|
||||
end
|
||||
|
||||
# Dummy symbolic flag.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# Example that always fails.
|
||||
class FailingExample < Spectator::RunnableExample
|
||||
# Dummy description.
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"FAIL"
|
||||
end
|
||||
|
||||
# Dummy source.
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new(__FILE__, __LINE__)
|
||||
end
|
||||
|
||||
# Dummy symbolic flag.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -6,17 +6,17 @@ class PassingExample < Spectator::RunnableExample
|
|||
end
|
||||
|
||||
# Dummy description.
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"PASS"
|
||||
end
|
||||
|
||||
# Dummy source.
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new(__FILE__, __LINE__)
|
||||
end
|
||||
|
||||
# Dummy symbolic flag.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
@symbolic
|
||||
end
|
||||
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
# This is useful for capturing what's going on when an event is running.
|
||||
class SpyExample < Spectator::RunnableExample
|
||||
# Dummy description.
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"SPY"
|
||||
end
|
||||
|
||||
# Dummy source.
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new(__FILE__, __LINE__)
|
||||
end
|
||||
|
||||
# Dummy symbolic flag.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
require "./spec_helper"
|
||||
|
||||
class ConcretePendingExample < Spectator::PendingExample
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"PENDING_TEST_EXAMPLE"
|
||||
end
|
||||
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new(__FILE__, __LINE__)
|
||||
end
|
||||
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Spectator
|
|||
end
|
||||
|
||||
# Checks whether the example satisfies the filter.
|
||||
def includes?(example)
|
||||
def includes?(example) : Bool
|
||||
@filters.any?(&.includes?(example))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1457,7 +1457,7 @@ module Spectator::DSL
|
|||
# Create a class derived from `RunnableExample` to run the test code.
|
||||
_spectator_example(Example%example, Test%example, ::Spectator::RunnableExample, {{what}}) do
|
||||
# Source where the example originated from.
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
||||
end
|
||||
|
||||
|
@ -1534,7 +1534,7 @@ module Spectator::DSL
|
|||
# Create a class derived from `PendingExample` to skip the test code.
|
||||
_spectator_example(Example%example, Test%example, ::Spectator::PendingExample, {{what}}) do
|
||||
# Source where the example originated from.
|
||||
def source
|
||||
def source : ::Spectator::Source
|
||||
::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
||||
end
|
||||
end
|
||||
|
@ -1650,7 +1650,7 @@ module Spectator::DSL
|
|||
getter instance
|
||||
|
||||
# Indicates whether the example references a method.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
{{what.is_a?(StringLiteral) && what.starts_with?('#') ? true : false}}
|
||||
end
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ module Spectator::DSL
|
|||
{{block.body}}
|
||||
|
||||
# Description for the test.
|
||||
def what
|
||||
def what : String | Symbol
|
||||
{{what.is_a?(StringLiteral) ? what : what.stringify}}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,17 +10,17 @@ module Spectator
|
|||
# This class shouldn't be used, it's just to trick the compiler.
|
||||
private class DummyExample < RunnableExample
|
||||
# Dummy description.
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"DUMMY"
|
||||
end
|
||||
|
||||
# Dummy symbolic flag.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
# Dummy source.
|
||||
def source
|
||||
def source : Source
|
||||
Source.new(__FILE__, __LINE__)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,8 +4,12 @@ module Spectator
|
|||
# Base class for all types of examples.
|
||||
# Concrete types must implement the `#run_impl, `#what`, `#instance`, and `#source` methods.
|
||||
abstract class Example < ExampleComponent
|
||||
@finished = false
|
||||
|
||||
# Indicates whether the example has already been run.
|
||||
getter? finished = false
|
||||
def finished? : Bool
|
||||
@finished
|
||||
end
|
||||
|
||||
# Group that the example belongs to.
|
||||
getter group : ExampleGroup
|
||||
|
@ -36,12 +40,12 @@ module Spectator
|
|||
end
|
||||
|
||||
# Indicates there is only one example to run.
|
||||
def example_count
|
||||
def example_count : Int
|
||||
1
|
||||
end
|
||||
|
||||
# Retrieve the current example.
|
||||
def [](index : Int)
|
||||
def [](index : Int) : Example
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ module Spectator
|
|||
# This is used as the base node type for the composite design pattern.
|
||||
abstract class ExampleComponent
|
||||
# Text that describes the context or test.
|
||||
abstract def what : String
|
||||
abstract def what : Symbol | String
|
||||
|
||||
# Indicates whether the example (or group) has been completely run.
|
||||
abstract def finished? : Bool
|
||||
|
|
|
@ -18,6 +18,7 @@ module Spectator
|
|||
# Creates the example group.
|
||||
# The hooks are stored to be triggered later.
|
||||
def initialize(@hooks : ExampleHooks, @conditions : ExampleConditions)
|
||||
@example_count = 0
|
||||
@before_all_hooks_run = false
|
||||
@after_all_hooks_run = false
|
||||
end
|
||||
|
@ -53,7 +54,9 @@ module Spectator
|
|||
end
|
||||
|
||||
# Number of examples in this group and all sub-groups.
|
||||
getter example_count = 0
|
||||
def example_count : Int
|
||||
@example_count
|
||||
end
|
||||
|
||||
# Retrieves an example by its index.
|
||||
# This recursively searches for an example.
|
||||
|
@ -118,7 +121,7 @@ module Spectator
|
|||
end
|
||||
|
||||
# Checks whether all examples in the group have been run.
|
||||
def finished?
|
||||
def finished? : Bool
|
||||
children.all?(&.finished?)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Spectator::Formatting
|
|||
end
|
||||
|
||||
# Status string specific to the result type.
|
||||
private def status
|
||||
private def status : String
|
||||
"FAIL"
|
||||
end
|
||||
|
||||
|
|
|
@ -25,15 +25,15 @@ module Spectator::Formatting
|
|||
return "#{seconds.round(2)} seconds" if seconds < 60
|
||||
|
||||
int_seconds = seconds.to_i
|
||||
minutes = int_seconds / 60
|
||||
minutes = int_seconds // 60
|
||||
int_seconds %= 60
|
||||
return sprintf("%i:%02i", minutes, int_seconds) if minutes < 60
|
||||
|
||||
hours = minutes / 60
|
||||
hours = minutes // 60
|
||||
minutes %= 60
|
||||
return sprintf("%i:%02i:%02i", hours, minutes, int_seconds) if hours < 24
|
||||
|
||||
days = hours / 24
|
||||
days = hours // 24
|
||||
hours %= 24
|
||||
sprintf("%i days %i:%02i:%02i", days, hours, minutes, int_seconds)
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module Spectator::Formatting
|
|||
end
|
||||
|
||||
# Status string specific to the result type.
|
||||
private def status
|
||||
private def status : String
|
||||
"TODO"
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Spectator::Formatting
|
|||
end
|
||||
|
||||
# Status string specific to the result type.
|
||||
private def status
|
||||
private def status : String
|
||||
"PASS"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module Spectator
|
|||
end
|
||||
|
||||
# Checks whether the example satisfies the filter.
|
||||
def includes?(example)
|
||||
def includes?(example) : Bool
|
||||
@line == example.source.line
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"all #{matcher.description}"
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"contains exactly #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"has attributes #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ module Spectator::Matchers
|
|||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||
snapshot = snapshot_values(actual.value)
|
||||
if match?(snapshot)
|
||||
FailedMatchData.new("#{actual.label} has attributes #{expected.label}", **values(snapshot))
|
||||
FailedMatchData.new("#{actual.label} has attributes #{expected.label}", **negated_values(snapshot))
|
||||
else
|
||||
SuccessfulMatchData.new
|
||||
end
|
||||
|
@ -79,5 +79,17 @@ module Spectator::Matchers
|
|||
}
|
||||
{% end %}
|
||||
end
|
||||
|
||||
# Produces the tuple for the failed negated match data from a snapshot of the attributes.
|
||||
private def negated_values(snapshot)
|
||||
{% begin %}
|
||||
{
|
||||
{% for attribute in ExpectedType.keys %}
|
||||
{{"expected " + attribute.stringify}}: "Not #{expected.value[{{attribute.symbolize}}].inspect}",
|
||||
{{"actual " + attribute.stringify}}: snapshot[{{attribute.symbolize}}].inspect,
|
||||
{% end %}
|
||||
}
|
||||
{% end %}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"matches #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value === actual.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not match #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} matched #{expected.label}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"changes #{expression.label} from #{expected_before.inspect} to #{expected_after.inspect}"
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"changes #{expression.label} from #{expected}"
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"changes #{expression.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"changes #{expression.label} #{@relativity}"
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"changes #{expression.label} to #{expected}"
|
||||
end
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is in #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value.includes?(actual.value)
|
||||
end
|
||||
|
||||
|
@ -23,7 +23,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not in #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -34,7 +34,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is in #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"contains #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value.all? do |item|
|
||||
actual.value.includes?(item)
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not match #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} contains #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is empty"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value.empty?
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not empty"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is empty"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"ends with #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"equals #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value == actual.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not equal #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} equals #{expected.label}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
if (message = @expected)
|
||||
"raises #{ExceptionType} with message #{message}"
|
||||
else
|
||||
|
|
|
@ -4,7 +4,7 @@ module Spectator::Matchers
|
|||
# Information about a failed match.
|
||||
struct FailedMatchData < MatchData
|
||||
# Indicates that the match failed.
|
||||
def matched?
|
||||
def matched? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"greater than or equal to #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value >= expected.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is less than #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is greater than or equal to #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"greater than #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value > expected.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is less than or equal to #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is greater than #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"has key #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value.has_key?(expected.value)
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not have key #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} has key #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"includes #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
if (value = actual.value).is_a?(String)
|
||||
match_string?(value)
|
||||
else
|
||||
|
@ -46,7 +46,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not include #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} includes #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"has #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not have #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -59,7 +59,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} has #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -76,7 +76,7 @@ module Spectator::Matchers
|
|||
end
|
||||
|
||||
# Checks if all predicate methods from the snapshot of them are satisified.
|
||||
private def match?(snapshot)
|
||||
private def match?(snapshot) : Bool
|
||||
# Test each predicate and immediately return false if one is false.
|
||||
{% for attribute in ExpectedType.keys %}
|
||||
return false unless snapshot[{{attribute.symbolize}}]
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"has value #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value.has_value?(expected.value)
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not have value #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} has value #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is not equal to #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value != actual.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is equal to #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is not equal to #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"less than or equal to #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value <= expected.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is greater than #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is less than or equal to #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"less than #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value < expected.value
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is greater than or equal to #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is less than #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is nil"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value.nil?
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not nil"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is nil"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -47,7 +47,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -58,7 +58,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is in #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -26,7 +26,7 @@ module Spectator::Matchers
|
|||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value.includes?(actual.value)
|
||||
end
|
||||
|
||||
|
@ -36,7 +36,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not in #{expected.label} (#{exclusivity})"
|
||||
end
|
||||
|
||||
|
@ -47,7 +47,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is in #{expected.label} (#{exclusivity})"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value.same?(actual.value)
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is #{expected.label}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"responds to #{label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"has size #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value == actual.value.size
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} does not have #{expected.label} elements"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} has #{expected.label} elements"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is the same size as #{expected.label}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value.size == actual.value.size
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not the same size as #{expected.label}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is the same size as #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"starts with #{expected.label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ module Spectator::Matchers
|
|||
# Information about a successful match.
|
||||
struct SuccessfulMatchData < MatchData
|
||||
# Indicates that the match succeeded.
|
||||
def matched?
|
||||
def matched? : Bool
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is #{label}"
|
||||
end
|
||||
|
||||
|
@ -83,7 +83,7 @@ module Spectator::Matchers
|
|||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
@truthy == !!actual.value
|
||||
end
|
||||
|
||||
|
@ -93,7 +93,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is #{negated_label}"
|
||||
end
|
||||
|
||||
|
@ -104,7 +104,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is #{label}"
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"is as #{Expected}"
|
||||
end
|
||||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) forall T
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
actual.value.is_a?(Expected)
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message(actual)
|
||||
private def failure_message(actual) : String
|
||||
"#{actual.label} is not a #{Expected}"
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
#
|
||||
# The message should typically only contain the test expression labels.
|
||||
# Actual values should be returned by `#values`.
|
||||
private def failure_message_when_negated(actual)
|
||||
private def failure_message_when_negated(actual) : String
|
||||
"#{actual.label} is a #{Expected}"
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ module Spectator::Matchers
|
|||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
def description
|
||||
def description : String
|
||||
"contains #{expected.label} in any order"
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Spectator
|
|||
end
|
||||
|
||||
# Checks whether the example satisfies the filter.
|
||||
def includes?(example)
|
||||
def includes?(example) : Bool
|
||||
@name == example.to_s
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ module Spectator
|
|||
end
|
||||
|
||||
# Indicates wheter the group references a type.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
@what.is_a?(Symbol)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module Spectator
|
|||
# Filter that matches all examples.
|
||||
class NullExampleFilter < ExampleFilter
|
||||
# Checks whether the example satisfies the filter.
|
||||
def includes?(example)
|
||||
def includes?(example) : Bool
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module Spectator
|
|||
# This class will not run example code.
|
||||
abstract class PendingExample < Example
|
||||
# Returns a pending result.
|
||||
private def run_impl
|
||||
private def run_impl : Result
|
||||
PendingResult.new(self)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,12 +5,12 @@ module Spectator
|
|||
# The root has no parent.
|
||||
class RootExampleGroup < ExampleGroup
|
||||
# Dummy value - this should never be used.
|
||||
def what
|
||||
def what : Symbol | String
|
||||
"ROOT"
|
||||
end
|
||||
|
||||
# Indicates that the group is symbolic.
|
||||
def symbolic?
|
||||
def symbolic? : Bool
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ module Spectator
|
|||
abstract class RunnableExample < Example
|
||||
# Runs the example, hooks, and captures the result
|
||||
# and translates to a usable result.
|
||||
def run_impl
|
||||
def run_impl : Result
|
||||
result = capture_result
|
||||
expectations = Internals::Harness.current.expectations
|
||||
translate_result(result, expectations)
|
||||
|
|
|
@ -7,7 +7,7 @@ module Spectator
|
|||
end
|
||||
|
||||
# Checks whether the example satisfies the filter.
|
||||
def includes?(example)
|
||||
def includes?(example) : Bool
|
||||
@source === example.source
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue