File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1260,4 +1260,27 @@ def test_render_anonymous_component_without_template
12601260 render_inline ( mock_component . new )
12611261 end
12621262 end
1263+
1264+ class CustomView < ActionView ::Base
1265+ def hi
1266+ "Hi!"
1267+ end
1268+ end
1269+
1270+ class GreetingComponent < ViewComponent ::Base
1271+ def call
1272+ # Calling `hi` directly doesn't work because ViewComponent::Base doesn't
1273+ # inherit from ActionView::Base:
1274+ #
1275+ # hi # raises: undefined method `hi' for #<GreetingComponent....
1276+ #
1277+ helpers . hi
1278+ end
1279+ end
1280+
1281+ def test_custom_base
1282+ custom_view = CustomView . with_empty_template_cache . with_view_paths [ ]
1283+
1284+ assert_includes ( "Hi!" , custom_view . render ( GreetingComponent . new ) )
1285+ end
12631286end
You can’t perform that action at this time.
0 commit comments