diff --git a/src/spectator/dsl/example_dsl.cr b/src/spectator/dsl/example_dsl.cr index 40a77b9..ba1d49c 100644 --- a/src/spectator/dsl/example_dsl.cr +++ b/src/spectator/dsl/example_dsl.cr @@ -1,6 +1,10 @@ +require "./matcher_dsl" + module Spectator module DSL module ExampleDSL + include MatcherDSL + macro is_expected expect(subject) end diff --git a/src/spectator/dsl/matcher_dsl.cr b/src/spectator/dsl/matcher_dsl.cr new file mode 100644 index 0000000..403a1c8 --- /dev/null +++ b/src/spectator/dsl/matcher_dsl.cr @@ -0,0 +1,11 @@ +require "../matchers" + +module Spectator + module DSL + module MatcherDSL + def eq(expected : T) forall T + ::Spectator::Matchers::EqualityMatcher(T).new(expected) + end + end + end +end diff --git a/src/spectator/matchers/equality_matcher.cr b/src/spectator/matchers/equality_matcher.cr index 0c6e39d..f9a3000 100644 --- a/src/spectator/matchers/equality_matcher.cr +++ b/src/spectator/matchers/equality_matcher.cr @@ -1,9 +1,5 @@ require "./matcher" -def eq(expected : T) forall T - Spectator::Matchers::EqualityMatcher(T).new(expected) -end - module Spectator module Matchers class EqualityMatcher(T) < Matcher