Skip to content

Commit 4cfdf8b

Browse files
hmachvitved
authored andcommitted
Ruby: Add test case for view without ERB template
1 parent 803513a commit 4cfdf8b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ruby/ql/test/library-tests/dataflow/erb/main.rb

+6
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ def run3
1616
view = View3.new(x)
1717
render(view)
1818
end
19+
20+
def run4
21+
x = source(5)
22+
view = View4.new(x)
23+
render(view)
24+
end
1925
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This component has no corresponding template file, because it defines a `call` method instead.
2+
3+
class View4 < ViewComponent::Base
4+
def initialize(x)
5+
@x = x
6+
end
7+
8+
def get
9+
@x
10+
end
11+
12+
def call
13+
"hi"
14+
end
15+
end

0 commit comments

Comments
 (0)