Skip to content

Why doesn’t Stringex work with Mocha?

December 19, 2011

If you are getting routing issues with models using acts_as_url from Stringex, but on in your tests, and only tests that use Mocha’s stubbing methods, this is for you.

Stringex does all of its acts_as_url crunching in before_validation callbacks.  If you are stubbing the :valid? method, that is your problem.  Mocha’s stubbing method actually rewrites the method being stubbed, therefore, unless you stub the :valid? method to actually call it’s callbacks you will no longer get all the handy url setting done by Stringex.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: