zevarito / route_dog

Watch and Notify your not tested routes of a RoR Application
MIT License
44 stars 1 forks source link

error on nil in erb processing #2

Closed neophiliac closed 13 years ago

neophiliac commented 13 years ago

Sorry, I haven't had time to trace this any farther. I hope this is useful!

Create A Html Report Of The Routes Defined, Tested And Used
rake aborted!
can't convert nil into String
(erb):35:in `+'
(erb):35
(erb):31:in `each'
(erb):31
/home/kls/.rvm/gems/ree-1.8.7-2011.03@saas3/gems/route_dog-2.3.1/lib/tasks/tasks.rake:21

Linux, REE, Rails 3.0.6.

zevarito commented 13 years ago

Hi @neophiliac!

Sorry about that, report and rake tasks need a serious refactor and tests :S

I have pushed to master a quick fix that at least should allow the report to be generated, please use master branch code to try if it works for you. Once you have run the report, please tell me which route under "Action" column has a content something like this...

"users#" or "#index" instead of "users#index"

Another thing that can help me a lot to figure out this issue, if you have time to try it, is this:

1) Go to the place where the gem is installed (bundle show route_dog if you are using Bundler)

2) Open the file lib/tasks/report.html.erb

3) Place a debugger before the line 35

4) Dump the content of "route" and paste it here.

Thanks!

neophiliac commented 13 years ago

There is no such file: lib/tasks/report.html.erb The only erb files are under the test directory.

Sorry for the crappy formatting on my report. I fixed it.

Edit: That erb file isn't in the gemspec, so it's not included.

Built the gem from master, new errors:

Create A Html Report Of The Routes Defined, Tested And Used
rake aborted!
nil is not a symbol
/home/kls/.rvm/gems/ree-1.8.7-2011.03@saas3/gems/route_dog-2.3.1/lib/tasks/tasks.rake:34:in `respond_to?'
/home/kls/.rvm/gems/ree-1.8.7-2011.03@saas3/gems/route_dog-2.3.1/lib/tasks/tasks.rake:34:in `implemented_route?'
(erb):36
(erb):31:in `each'
(erb):31
/home/kls/.rvm/gems/ree-1.8.7-2011.03@saas3/gems/route_dog-2.3.1/lib/tasks/tasks.rake:22
zevarito commented 13 years ago

ops, I forget to add it to the gemspec, I will add it now.

If you want to try before I've add it to the gemspec you can do it in your Gemfile

gem 'route_dog', :git => "git://github.com/zevarito/route_dog.git"

Anyway, I will push the patch and let you know, Thanks for trying this!

zevarito commented 13 years ago

Done, I've updated the gemspec.

neophiliac commented 13 years ago

Same error.

I'm sorry I can't give you a dump of the route at that point in the erb processing; to_yaml fails and it overflows my terminal's scrollback buffer. There has to be something smaller I can look up and send to you; you're not going to dig through 80k+ of route dump anyway, right?

So I stepped through the loop looking at the route.path until it crashed. It died on a route that I use to display static pages (about, terms, etc.). It still dies in 'implemented_route?'.

I hope this is useful.

zevarito commented 13 years ago

Can you show me how that route is defined in your config/routes and how it is show when you do rake routes from the terminal?

Thanks!

neophiliac commented 13 years ago

rake routes

page        /pages/:action(.:format)                   {:controller=>"pages"}

routes.rb

match '/pages/:action', :controller => 'pages', :as => 'page'
zevarito commented 13 years ago

That was totally helpful! I have identified the issue and I will be pushing a patch soon, I will let you know.

zevarito commented 13 years ago

@neophiliac

I'have pushed a new version of the gem (2.4.0) with a fix to this issue, please tell me if it works for you. Thanks!

neophiliac commented 13 years ago

Works. I'm not sure it's reliably catching what has been implemented, but since it's not crashing I can at least dig a little deeper.

Thanks!