diff --git a/src/spectator/dsl/groups.cr b/src/spectator/dsl/groups.cr index 5d112ac..429cf85 100644 --- a/src/spectator/dsl/groups.cr +++ b/src/spectator/dsl/groups.cr @@ -19,7 +19,9 @@ module Spectator %source = ::Spectator::Source.new({{_source_file}}, {{_source_line}}) ::Spectator::SpecBuilder.start_group({{description}}, %source) - {% if (what.is_a?(Path) || what.is_a?(Generic)) && (described_type = what.resolve?) %} + # Oddly, `#resolve?` can return a constant's value, which isn't a TypeNode. + # Ensure `described_class` and `subject` are only set for real types (is a `TypeNode`). + {% if (what.is_a?(Path) || what.is_a?(Generic)) && (described_type = what.resolve?).is_a?(TypeNode) %} macro described_class {{described_type.name}} end