Ruby: Add test case for view without ERB template

This commit is contained in:
Harry Maclean
2024-01-29 14:50:44 +00:00
committed by Tom Hvitved
parent 803513acc6
commit 4cfdf8b7a3
2 changed files with 21 additions and 0 deletions

View File

@@ -16,4 +16,10 @@ class App
view = View3.new(x)
render(view)
end
def run4
x = source(5)
view = View4.new(x)
render(view)
end
end

View File

@@ -0,0 +1,15 @@
# This component has no corresponding template file, because it defines a `call` method instead.
class View4 < ViewComponent::Base
def initialize(x)
@x = x
end
def get
@x
end
def call
"hi"
end
end