On 9/8/10 11:42 AM, Brian Kaney wrote:
Hey Everyone,
Is it good practice to call matchers from within matchers? Kinda like this
pattern:
See: http://gist.github.com/570467
No, that should be avoided. The problem is that the "internal" matcher
will throw an exception that will bubble up and be reported. Meaning
that the parent matcher (link_one in your case) is not reported and the
resulting stacktrace can be confusing. Try something like this:
include_association(expected).matches?(actual) &&
associate_one(expected).matches?(actual)
(Note, I have not tried the above but I think it should work.)
-Ben
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users