[rspec-users] Custom Matcher and Webrat methods

Rodrigo Rosenfeld Rosas lbocseg at yahoo.com.br
Tue Dec 8 17:04:06 EST 2009

I would like to be able to write a custom matcher so that I could call 
this test, for instance:

@user.should be_allowed_to_visit(url)
@non_welcome.should_not be_allowed_to_visit(url)

The matcher would call Webrat methods such as 'visit'.

The problem is that it would try to call 'visit' from User class instead 
of the binding in which @user access is verified...

I have manually set the binding to the Matcher in a before(:all), to 
avoid calling 'be_allowed_to_visit(url, binding)', but I would like to 
know if there would be a better way to "get" this binding...

Any thoughts on that?


Faça ligações para outros computadores com o novo Yahoo! Messenger 

More information about the rspec-users mailing list