Uncomment predicate matcher

This commit is contained in:
Michael Miller 2019-11-09 09:38:11 -07:00
parent 48363951c2
commit 66dc6bf098

View file

@ -703,33 +703,33 @@ module Spectator
# # Is equivalent to: # # Is equivalent to:
# expect("foobar".has_back_references?).to_not be_true # expect("foobar".has_back_references?).to_not be_true
# ``` # ```
# macro method_missing(call) macro method_missing(call)
# {% if call.name.starts_with?("be_") %} {% if call.name.starts_with?("be_") %}
# # Remove `be_` prefix. # Remove `be_` prefix.
# {% method_name = call.name[3..-1] %} {% method_name = call.name[3..-1] %}
# {% matcher = "PredicateMatcher" %} {% matcher = "PredicateMatcher" %}
# {% elsif call.name.starts_with?("have_") %} {% elsif call.name.starts_with?("have_") %}
# # Remove `have_` prefix. # Remove `have_` prefix.
# {% method_name = call.name[5..-1] %} {% method_name = call.name[5..-1] %}
# {% matcher = "HavePredicateMatcher" %} {% matcher = "HavePredicateMatcher" %}
# {% else %} {% else %}
# {% raise "Undefined local variable or method '#{call}'" %} {% raise "Undefined local variable or method '#{call}'" %}
# {% end %} {% end %}
#
# descriptor = { {{method_name}}: Tuple.new({{call.args.splat}}) } descriptor = { {{method_name}}: Tuple.new({{call.args.splat}}) }
# label = String::Builder.new({{method_name.stringify}}) label = String::Builder.new({{method_name.stringify}})
# {% unless call.args.empty? %} {% unless call.args.empty? %}
# label << '(' label << '('
# {% for arg, index in call.args %} {% for arg, index in call.args %}
# label << {{arg}} label << {{arg}}
# {% if index < call.args.size - 1 %} {% if index < call.args.size - 1 %}
# label << ", " label << ", "
# {% end %} {% end %}
# {% end %} {% end %}
# label << ')' label << ')'
# {% end %} {% end %}
# test_value = ::Spectator::TestValue.new(descriptor, label.to_s) test_value = ::Spectator::TestValue.new(descriptor, label.to_s)
# ::Spectator::Matchers::{{matcher.id}}.new(test_value) ::Spectator::Matchers::{{matcher.id}}.new(test_value)
# end end
end end
end end