[rspec-devel] [ rspec-Bugs-13065 ] Named routes throw a NoMethodError in Helper specs

noreply at rubyforge.org noreply at rubyforge.org
Wed Aug 15 00:34:27 EDT 2007


Bugs item #13065, was opened at 2007-08-14 18:12
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13065&group_id=797

Category: rails plugin
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: James Deville (parcelbrat)
>Assigned to: David Chelimsky (dchelimsky)
Summary: Named routes throw a NoMethodError in Helper specs

Initial Comment:
Using named routes in RSpec 1.0.8 inside of Helper specs throws a NoMethodError. 

Looking into the code some, the use of a named route like root_path is getting into the method_missing in lib/spec/matchers.rb on line 157. From there it is going to the super which is calling PrototypeHelper.method_missing in rails/actionpack/lib/action_view/helpers/prototype_helper.rb line 658, which calls a new JavaScriptProxy

That seems to be the issue. I'm going to look into why method_missing jumps straight to the JS stuff, not the named routes and such.

I'll add some patches for tests and try to fix it.



----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-15 04:34

Message:
Fixed in 2348 - I received two patches that both do essentially the same fix - one here from you and one from Mike Mangino so I added you both in the contributors list.

Thanks for getting this to work - a lot of people have been looking for this.

----------------------------------------------------------------------

Comment By: James Deville (parcelbrat)
Date: 2007-08-14 20:30

Message:
Never mind that. The svn revert going on in pre_commit was making my tests 
fail, because it removed my named_route.

 I'm attaching a diff that will fix it, but to make the tests work you need to 
add   map.named '/named_route', :controller => 'people', :action => 'index' 
to config/routes.rb. This needs to be added to the route.rb, which is getting 
reverted via a svn revert. I get a pass on the first time and a fail on the other 
times.


----------------------------------------------------------------------

Comment By: James Deville (parcelbrat)
Date: 2007-08-14 20:15

Message:
Adding 'ActionController::Routing::Routes.named_routes.install(self.class) to line 
64 of rspec_on_rails/lib/spec/rails/dsl/behaviour/helper.rb fixes this issue in 
my project, but not in the test I added. I'm unsure why they are differing.

----------------------------------------------------------------------

Comment By: James Deville (parcelbrat)
Date: 2007-08-14 19:42

Message:
ActionController::Routing::Routes.named_rotes.install(self.class) inside of a ruby 
debug instance (thus inside of an Example) appears to fix this. I'm looking where 
to put that now.

----------------------------------------------------------------------

Comment By: James Deville (parcelbrat)
Date: 2007-08-14 18:55

Message:
Here is a diff. It may not have included the route. If not, add   "map.connect 
'custom_route', :controller => 'custom_route_spec', :action => 'custom_route'" 
to the example_rails_app routes.rb file. I don't know if I can figure out where the 
error is, any help would be appreciated, but I will try.

JD



----------------------------------------------------------------------

Comment By: James Deville (parcelbrat)
Date: 2007-08-14 18:47

Message:
This may be related to bug#13020

----------------------------------------------------------------------

Comment By: James Deville (parcelbrat)
Date: 2007-08-14 18:45

Message:
I'm running edge right now. REV: 7192. I'm working on getting a spec for it, but 
having trouble getting a named route set up to test against.

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-08-14 18:28

Message:
Can you please mention what Rails version(s)/revision(s) you have seen this in?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13065&group_id=797


More information about the rspec-devel mailing list