diff --git a/src/spectator/dsl/examples.cr b/src/spectator/dsl/examples.cr index 740260c..beb07b6 100644 --- a/src/spectator/dsl/examples.cr +++ b/src/spectator/dsl/examples.cr @@ -41,7 +41,7 @@ module Spectator::DSL %source = ::Spectator::Source.new({{_source_file}}, {{_source_line}}) ::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, {{@type.name}} ) { |test| test.as({{@type.name}}).%run } @@ -68,7 +68,7 @@ module Spectator::DSL %source = ::Spectator::Source.new({{_source_file}}, {{_source_line}}) ::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, {{@type.name}} ) { |test| test.as({{@type.name}}).%run } diff --git a/src/spectator/dsl/mocks.cr b/src/spectator/dsl/mocks.cr index 07d3c00..7ffcfc8 100644 --- a/src/spectator/dsl/mocks.cr +++ b/src/spectator/dsl/mocks.cr @@ -2,7 +2,7 @@ require "../mocks" module Spectator::DSL 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}}) {% else %} {% @@ -56,7 +56,7 @@ module Spectator::DSL end 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}}) {% else %} {% diff --git a/src/spectator/matchers/attributes_matcher.cr b/src/spectator/matchers/attributes_matcher.cr index 2a72d5b..ec8826f 100644 --- a/src/spectator/matchers/attributes_matcher.cr +++ b/src/spectator/matchers/attributes_matcher.cr @@ -30,7 +30,7 @@ module Spectator::Matchers if match?(snapshot) SuccessfulMatchData.new(description) 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 @@ -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(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 SuccessfulMatchData.new(description) end diff --git a/src/spectator/matchers/have_predicate_matcher.cr b/src/spectator/matchers/have_predicate_matcher.cr index 7b23cd0..5cb3f94 100644 --- a/src/spectator/matchers/have_predicate_matcher.cr +++ b/src/spectator/matchers/have_predicate_matcher.cr @@ -20,7 +20,7 @@ module Spectator::Matchers if match?(snapshot) SuccessfulMatchData.new(description) 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 @@ -29,7 +29,7 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) 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 SuccessfulMatchData.new(description) end diff --git a/src/spectator/matchers/predicate_matcher.cr b/src/spectator/matchers/predicate_matcher.cr index bacfac0..bda4f9b 100644 --- a/src/spectator/matchers/predicate_matcher.cr +++ b/src/spectator/matchers/predicate_matcher.cr @@ -26,7 +26,7 @@ module Spectator::Matchers if match?(snapshot) SuccessfulMatchData.new(description) 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 @@ -35,7 +35,7 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) 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 SuccessfulMatchData.new(description) end diff --git a/src/spectator/matchers/respond_matcher.cr b/src/spectator/matchers/respond_matcher.cr index 59a955f..87f95a9 100644 --- a/src/spectator/matchers/respond_matcher.cr +++ b/src/spectator/matchers/respond_matcher.cr @@ -19,7 +19,7 @@ module Spectator::Matchers if snapshot.values.all? SuccessfulMatchData.new(description) 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 @@ -28,7 +28,7 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) 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 SuccessfulMatchData.new(description) end