[rspec-users] Edge, link_to and mocks

Marcus Crafter crafterm at gmail.com
Fri Jul 6 02:11:30 EDT 2007

Hi All,

Anyone noticed that using the newer link_to syntax in edge currently  
fails with mocked objects in view specs or helpers.

eg. if you have something like the following in your view (or  
equivalent in a helper):

	<%= link_to @dog.name, @dog %>

as opposed to the current 1.2 syntax:

	<%= link_to @dog.name, dog_path(@dog) %>

Using a mock_model as the 'dog' will raise a:

	undefined method `polymorphic_path' for [Dynamically generated class  
for RSpec example]:#<Class:0x26814f4>

error - I presume due to the introspection on the @dog object to find  
out what kind of class it is to create it's URL.

Anyone worked around this at all, other than using the older syntax?  
Any ideas appreciated.



More information about the rspec-users mailing list