Closed agrobbin closed 3 years ago
@agrobbin sounds like a good idea to me! Would you like to take a crack at implementing this?
cc @juanmanuelramallo
@joelhawksley sure! The class_attribute
switch should be relatively easy. I'll have to think about the best way to extract the right test_controller
. A couple sanity check questions if you don't mind:
Is controller
something that should remain part of the public TestHelpers
interface? Or is it something that can be made private to the render_inline
helper method (this would make extracting the test_controller
very easy, but breaks the current contract of controller
being something that's theoretically usable by tests).
@agrobbin Sounds good!
controller
does need to remain public.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sorry Stalebot, I was clearly too slow here! I've issued #465 to add this functionality.
Feature request
Right now, there is no way to customize the
test_controller
on a per-component-basis, which has made it difficult for us to test different groups of components.Base.test_controller
is amattr_accessor
, which doesn't allow customizing on a per-component basis. Additionally,TestHelpers#controller
always usesBase.test_controller
, rather than using thetest_controller
of the component currently under test.If
Base.test_controller
was changed to aclass_attribute
, andTestHelpers#controller
was changed to use the more specific one, the default scenario of everyone usingApplicationController
would continue to work, while those who want to isolated different namespaces of an application's components would be able to do so!Motivation
We have 3 different namespaces within our application, each with its own set of view components (and each with their own base controller class, i.e.
Foo::BaseController
andBar::BaseController
). We'd love to be able to mirror that hierarchy in our component classes, havingFoo::BaseComponent
that all of ourFoo
ey components inherit from, and then be able to inherit from something other thanApplicationController
in those component's tests.