mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Add content_for and yield_content helpers <3. Thanks @RX14
This commit is contained in:
parent
73d6123f3d
commit
21b194a901
3 changed files with 17 additions and 23 deletions
|
@ -1,6 +1,5 @@
|
|||
Hello <%= name %>
|
||||
|
||||
<% content_for "custom" do |io| %>
|
||||
io << "<h1> Hello from otherside </h1>"
|
||||
io
|
||||
<% content_for "custom" do %>
|
||||
<h1>Hello from otherside</h1>
|
||||
<% end %>
|
|
@ -36,12 +36,13 @@ describe "Views" do
|
|||
end
|
||||
|
||||
it "renders layout with content_for" do
|
||||
get "/view" do
|
||||
name = "Kemal"
|
||||
get "/view/:name" do |env|
|
||||
name = env.params.url["name"]
|
||||
render "spec/asset/hello_with_content_for.ecr", "spec/asset/layout_with_yield.ecr"
|
||||
end
|
||||
request = HTTP::Request.new("GET", "/view")
|
||||
request = HTTP::Request.new("GET", "/view/world")
|
||||
client_response = call_request_on_app(request)
|
||||
client_response.body.should contain("<html>Hello world")
|
||||
client_response.body.should contain("<h1>Hello from otherside</h1>")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue