Skip to content

Commit

Permalink
Add a failing test case for rendering a partial with a block from phlex
Browse files Browse the repository at this point in the history
  • Loading branch information
willcosgrove committed Apr 5, 2024
1 parent 2ac2756 commit d181f12
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/dummy/app/controllers/rendering_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RenderingController < ApplicationController
def partial_from_phlex
render Rendering::PartialFromPhlex.new
end
end
3 changes: 3 additions & 0 deletions test/dummy/app/views/rendering/_partial.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<%= yield %>
</div>
9 changes: 9 additions & 0 deletions test/dummy/app/views/rendering/partial_from_phlex.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Rendering
class PartialFromPhlex < ApplicationView
def view_template
render "partial" do
h1 "Partial from Phlex"
end
end
end
end
2 changes: 2 additions & 0 deletions test/dummy/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@
get "/helpers/form_with", to: "helpers#form_with"
get "/helpers/tag", to: "helpers#tag"
get "/helpers/missing_helper", to: "helpers#missing_helper"

get "/rendering/partial_from_phlex", to: "rendering#partial_from_phlex"
end
10 changes: 10 additions & 0 deletions test/phlex/render_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require "test_helper"

class RenderTest < ActionDispatch::IntegrationTest
test "rendering partial from Phlex view" do
get "/rendering/partial_from_phlex"
assert_response :success
end
end

0 comments on commit d181f12

Please sign in to comment.