mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Merge branch 'master' into example-api
This commit is contained in:
commit
de99fce5b1
6 changed files with 12 additions and 12 deletions
|
@ -41,7 +41,7 @@ module Spectator::DSL
|
||||||
|
|
||||||
%source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
%source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
||||||
::Spectator::SpecBuilder.add_example(
|
::Spectator::SpecBuilder.add_example(
|
||||||
{{description.is_a?(StringLiteral) || description.is_a?(NilLiteral) ? description : description.stringify}},
|
{{description.is_a?(StringLiteral) || description.is_a?(StringInterpolation) || description.is_a?(NilLiteral) ? description : description.stringify}},
|
||||||
%source,
|
%source,
|
||||||
{{@type.name}}
|
{{@type.name}}
|
||||||
) { |test| test.as({{@type.name}}).%run }
|
) { |test| test.as({{@type.name}}).%run }
|
||||||
|
@ -68,7 +68,7 @@ module Spectator::DSL
|
||||||
|
|
||||||
%source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
%source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
||||||
::Spectator::SpecBuilder.add_pending_example(
|
::Spectator::SpecBuilder.add_pending_example(
|
||||||
{{description.is_a?(StringLiteral) || description.is_a?(NilLiteral) ? description : description.stringify}},
|
{{description.is_a?(StringLiteral) || description.is_a?(StringInterpolation) || description.is_a?(NilLiteral) ? description : description.stringify}},
|
||||||
%source,
|
%source,
|
||||||
{{@type.name}}
|
{{@type.name}}
|
||||||
) { |test| test.as({{@type.name}}).%run }
|
) { |test| test.as({{@type.name}}).%run }
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "../mocks"
|
||||||
|
|
||||||
module Spectator::DSL
|
module Spectator::DSL
|
||||||
macro double(name = "Anonymous", **stubs, &block)
|
macro double(name = "Anonymous", **stubs, &block)
|
||||||
{% if name.is_a?(StringLiteral) %}
|
{% if name.is_a?(StringLiteral) || name.is_a?(StringInterpolation) %}
|
||||||
anonymous_double({{name}}, {{stubs.double_splat}})
|
anonymous_double({{name}}, {{stubs.double_splat}})
|
||||||
{% else %}
|
{% else %}
|
||||||
{%
|
{%
|
||||||
|
@ -56,7 +56,7 @@ module Spectator::DSL
|
||||||
end
|
end
|
||||||
|
|
||||||
macro null_double(name, **stubs, &block)
|
macro null_double(name, **stubs, &block)
|
||||||
{% if name.is_a?(StringLiteral) %}
|
{% if name.is_a?(StringLiteral) || name.is_a?(StringInterpolation) %}
|
||||||
anonymous_null_double({{name}}, {{stubs.double_splat}})
|
anonymous_null_double({{name}}, {{stubs.double_splat}})
|
||||||
{% else %}
|
{% else %}
|
||||||
{%
|
{%
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Spectator::Matchers
|
||||||
if match?(snapshot)
|
if match?(snapshot)
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
else
|
else
|
||||||
FailedMatchData.new(description, "#{actual.label} does not have attributes #{expected.label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} does not have attributes #{expected.label}", values(snapshot).to_a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ module Spectator::Matchers
|
||||||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||||
snapshot = snapshot_values(actual.value)
|
snapshot = snapshot_values(actual.value)
|
||||||
if match?(snapshot)
|
if match?(snapshot)
|
||||||
FailedMatchData.new(description, "#{actual.label} has attributes #{expected.label}", **negated_values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} has attributes #{expected.label}", negated_values(snapshot).to_a)
|
||||||
else
|
else
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ module Spectator::Matchers
|
||||||
if match?(snapshot)
|
if match?(snapshot)
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
else
|
else
|
||||||
FailedMatchData.new(description, "#{actual.label} does not have #{expected.label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} does not have #{expected.label}", values(snapshot).to_a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ module Spectator::Matchers
|
||||||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||||
snapshot = snapshot_values(actual.value)
|
snapshot = snapshot_values(actual.value)
|
||||||
if match?(snapshot)
|
if match?(snapshot)
|
||||||
FailedMatchData.new(description, "#{actual.label} has #{expected.label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} has #{expected.label}", values(snapshot).to_a)
|
||||||
else
|
else
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Spectator::Matchers
|
||||||
if match?(snapshot)
|
if match?(snapshot)
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
else
|
else
|
||||||
FailedMatchData.new(description, "#{actual.label} is not #{expected.label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} is not #{expected.label}", values(snapshot).to_a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ module Spectator::Matchers
|
||||||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||||
snapshot = snapshot_values(actual.value)
|
snapshot = snapshot_values(actual.value)
|
||||||
if match?(snapshot)
|
if match?(snapshot)
|
||||||
FailedMatchData.new(description, "#{actual.label} is #{expected.label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} is #{expected.label}", values(snapshot).to_a)
|
||||||
else
|
else
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ module Spectator::Matchers
|
||||||
if snapshot.values.all?
|
if snapshot.values.all?
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
else
|
else
|
||||||
FailedMatchData.new(description, "#{actual.label} does not respond to #{label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} does not respond to #{label}", values(snapshot).to_a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ module Spectator::Matchers
|
||||||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||||
snapshot = snapshot_values(actual.value)
|
snapshot = snapshot_values(actual.value)
|
||||||
if snapshot.values.any?
|
if snapshot.values.any?
|
||||||
FailedMatchData.new(description, "#{actual.label} responds to #{label}", **values(snapshot))
|
FailedMatchData.new(description, "#{actual.label} responds to #{label}", values(snapshot).to_a)
|
||||||
else
|
else
|
||||||
SuccessfulMatchData.new(description)
|
SuccessfulMatchData.new(description)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue