diff --git a/spec/internal/app/controllers/articles_controller.rb b/spec/internal/app/controllers/articles_controller.rb index e051da06..6a6e73e4 100644 --- a/spec/internal/app/controllers/articles_controller.rb +++ b/spec/internal/app/controllers/articles_controller.rb @@ -8,4 +8,8 @@ def index end def show; end + + def preview + render Articles::PreviewView + end end diff --git a/spec/internal/app/views/articles/preview_view.rb b/spec/internal/app/views/articles/preview_view.rb new file mode 100644 index 00000000..7ae2b990 --- /dev/null +++ b/spec/internal/app/views/articles/preview_view.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class Articles::PreviewView < Phlex::HTML + def template + render(template: "articles/show") + end +end diff --git a/spec/internal/config/routes.rb b/spec/internal/config/routes.rb index 8d573aa9..9aa73534 100644 --- a/spec/internal/config/routes.rb +++ b/spec/internal/config/routes.rb @@ -9,4 +9,5 @@ get "articles/index", to: "articles#index" get "articles/show", to: "articles#show" + get "articles/preview", to: "articles#preview" end diff --git a/spec/layout_spec.rb b/spec/layout_spec.rb index 95f049ef..200c48f1 100644 --- a/spec/layout_spec.rb +++ b/spec/layout_spec.rb @@ -14,4 +14,10 @@ expect(response.body).to eq %(Article
\n

Article

\n
) end + + it "supports rendering templates" do + get "/articles/preview" + + expect(response.body).to eq %(Article
\n

Article

\n
) + end end