ActionView::TestCase, helper that uses asset_path #7534

Closed
jrochkind opened this Issue Sep 5, 2012 · 11 comments

Projects

None yet

8 participants

@jrochkind

I have an ordinary helper module that has a method, where part of it's implementation calls the #asset_path helper. This works fine.

I have an ActionView::TestCase that tests/calls this helper. This generally works fine, unless it tries to call the helper method that calls asset_path.

I get a:

undefined method `asset_path' for #<BentoSearchHelperTest:0x0000000f9aefc0>
.../actionpack-3.2.8/lib/action_dispatch/testing/assertions/routing.rb:176:in `method_missing'
..../actionpack-3.2.8/lib/action_view/test_case.rb:236:in `method_missing'

As you can see I'm using rails 3.2.8.

I believe this is a bug. But correct me if I'm wrong and I'm doing something wrong or something.

@steveklabnik
Ruby on Rails member

Hmmm. I am not sure. @pixeltrix are the url helpers included in ActionView::TestCase? Should they be?

@BrandonMathis

I'm able to reproduce this in 3.2.8

https://gist.github.com/4035922

@nikitug

AssetUrlHelper is not included in ActionView::Helpers in 3-2-stable, but it's already fixed in master (@9fa1a54). So it should be ok to include it in 3-2-stable too.

@BrandonMathis

I still seeing this issue in 3.2.9rc2 Not sure if it is fixed in edge since I am having some issues installing from edge at the moment but I believe the commit you pointed to is merged in with the 3.2.3-stable branch.

@senny
Ruby on Rails member

related to #7218

@lunks

What is the current status? Should we add the Asset URL helpers to ActionView::Helpers in 3.2.x or is it okay to leave it as it is? Should we close this one (and the related issue), or do we welcome a pull request?

@rafaelfranca
Ruby on Rails member

We can fix this one

@lunks

Is it safe to just backport the commit?

@rafaelfranca
Ruby on Rails member

@lunks unfortunately not. That commit change show sprockets glue with Rails to make possible to us extract sprockets-rails.

@lunks lunks added a commit to lunks/rails that referenced this issue Sep 22, 2013
@lunks lunks Adding asset_path to ActionView::Helpers::AssetTagHelper
Fixes #7534.
eb8f728
@jrochkind jrochkind added the stale label Apr 23, 2014
@rafaelfranca
Ruby on Rails member

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Rails team are limited, and so we are asking for your help.

If you can still reproduce this error on the 4-1-stable, 4-0-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

@rails-bot rails-bot closed this May 27, 2014
@rails-bot

This issue has been automatically closed because of inactivity.

If you can still reproduce this error on the 4-1-stable, 4-0-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment