[rspec-users] Passing self to matchers
dchelimsky at gmail.com
Mon Apr 13 06:39:18 EDT 2009
On Mon, Apr 13, 2009 at 4:19 AM, Brandon Olivares
<programmer2188 at gmail.com> wrote:
> I've noticed in several matchers that the matcher method passes self to the
> constructor of the class. Then that's used to call several of the methods
> used. For instance, in RouteFor, self is passed, and it is used to call
> I'm just curious why this is, and when this is required.
Because assert_recognizes is defined in the context of the example,
not inside the scope of the matcher. This is only necessary in such
cases that helper methods are outside the matcher itself.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users