content_for failing

This commit is contained in:
Serdar Dogruyol 2022-06-26 13:44:06 +03:00
parent 1d54971efa
commit 7d6c546a49
4 changed files with 12 additions and 8 deletions

View file

@ -1,5 +1,5 @@
Hello <%= name %>
<% content_for "custom" do %>
<h1>Hello from otherside</h1>
<% content_for "meta" do %>
<title>Kemal Spec</title>
<% end %>

View file

@ -1,6 +1,8 @@
<html>
<head>
<%= yield_content "meta" %>
</head>
<body>
<%= content %>
<%= yield_content "custom" %>
</body>
</html>

View file

@ -1,8 +1,10 @@
<html>
<head>
<%= yield_content "meta" %>
</head>
<body>
<%= content %>
<%= yield_content "custom" %>
<%= var1 %>
<%= var2 %>
<%= var1 %>
<%= var2 %>
</body>
</html>

View file

@ -56,8 +56,8 @@ describe "Views" do
end
request = HTTP::Request.new("GET", "/view/world")
client_response = call_request_on_app(request)
client_response.body.should contain("Hello world")
client_response.body.should contain("<h1>Hello from otherside</h1>")
client_response.body.scan("Hello world").size.should eq(1)
client_response.body.should contain("<title>Kemal Spec</title>")
end
it "does not render content_for that was not yielded" do