This project is archived and is in readonly mode.

#4775 ✓stale
David Chelimsky

helper(:all) raises error in an ActionView::TestCase

Reported by David Chelimsky | June 6th, 2010 @ 12:20 PM

# test/helpers/gadgets_helper_test.rb
require 'test_helper'

class GadgetsHelperTest < ActionView::TestCase
  helper :all

  test "something" do
    # ...
  end
end

Running this yields the following error:

rails/activesupport/lib/active_support/dependencies.rb:277:in `depend_on': Missing helper file helpers/all_helper.rb (LoadError)

Here's the full backtrace:

$ rake test:units
(in /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/example_app)
/Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/activesupport/lib/active_support/dependencies.rb:277:in `depend_on': Missing helper file helpers/all_helper.rb (LoadError)
    from /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/activesupport/lib/active_support/dependencies.rb:189:in `require_dependency'
    from /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/actionpack/lib/abstract_controller/helpers.rb:131:in `modules_for_helpers'
    from /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/actionpack/lib/abstract_controller/helpers.rb:127:in `map!'
    from /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/actionpack/lib/abstract_controller/helpers.rb:127:in `modules_for_helpers'
    from /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/actionpack/lib/abstract_controller/helpers.rb:91:in `helper'
    from ./test/unit/helpers/gadgets_helper_test.rb:4

helper(:all) works in controllers because controllers include ActionController::Metal::Helpers, but ActionView::TestCase::Behavior does not do the same.

I started to look at patching ActionView::TestCase::Behavior to include ActionController::Metal::Helpers, and got this very interesting error:

$ rake test:units
(in /Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/example_app)
/Users/dchelimsky/projects/ruby/rspec2/repos/rspec-rails/tmp/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant': ActionController is not missing constant Helpers! (ArgumentError)

I'll continue to look at this, but I wanted to get this documented in the mean time.

Comments and changes to this ticket

  • David Chelimsky

    David Chelimsky June 6th, 2010 @ 12:20 PM

    • Assigned user changed from “Yehuda Katz (wycats)” to “José Valim”
  • David Chelimsky

    David Chelimsky June 6th, 2010 @ 12:28 PM

    The documentation in AbstractController::Helpers is misleading. It says that you can say helper(:all), but that only works in classes that also include ActionController::Metal::Helpers, which overrides helper, decorating it with support for :all.

  • David Chelimsky

    David Chelimsky June 21st, 2010 @ 05:52 PM

    • Assigned user changed from “José Valim” to “Yehuda Katz (wycats)”
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 05:02 PM

    • State changed from “new” to “open”

    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 core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 05:02 PM

    • State changed from “open” to “stale”
  • csnk

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages