lib/rspec/matchers/built_in/yield.rb in rspec-expectations-2.99.0.beta1 vs lib/rspec/matchers/built_in/yield.rb in rspec-expectations-2.99.0.beta2
- old
+ new
@@ -179,20 +179,21 @@
end
end
end
class YieldWithArgs
+ include MatchAliases
+
def initialize(*args)
@expected = args
end
def matches?(block)
@probe = YieldProbe.probe(block)
@actual = @probe.single_yield_args
@probe.yielded_once?(:yield_with_args) && args_match?
end
- alias == matches?
def failure_message_for_should
"expected given block to yield with arguments, but #{positive_failure_reason}"
end
@@ -249,19 +250,20 @@
end
end
end
class YieldSuccessiveArgs
+ include MatchAliases
+
def initialize(*args)
@expected = args
end
def matches?(block)
@probe = YieldProbe.probe(block)
@actual = @probe.successive_yield_args
args_match?
end
- alias == matches?
def failure_message_for_should
"expected given block to yield successively with arguments, but yielded with unexpected arguments" +
"\nexpected: #{@expected.inspect}" +
"\n got: #{@actual.inspect} (compared using === and ==)"