From d2f1b4f856d3d279e1e805d2c5610a2514b555e2 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Tue, 12 Jan 2021 11:55:05 -0600 Subject: [PATCH] [rails6] Use relative paths for layouts Fixes the following Deprecation warnings: DEPRECATION WARNING: Rendering layouts from an absolute path is deprecated. (called from render_pdf_internal_rr at /home/travis/build/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/report_downloads.rb:47) DEPRECATION WARNING: Rendering layouts from an absolute path is deprecated. (called from print_report at /Users/nicklamuro/code/redhat/manageiq-ui-classic/app/controllers/application_controller/report_downloads.rb:124) DEPRECATION WARNING: Rendering layouts from an absolute path is deprecated. (called from set_summary_pdf_data at /home/travis/build/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/report_downloads.rb:234) Caused by the Rails 6.0 Upgrade --- .../application_controller/report_downloads.rb | 10 +++++----- .../controllers/application_controller/compare_spec.rb | 4 ++-- .../application_controller/report_downloads_spec.rb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/application_controller/report_downloads.rb b/app/controllers/application_controller/report_downloads.rb index 18820647f02..cd29222bbc8 100644 --- a/app/controllers/application_controller/report_downloads.rb +++ b/app/controllers/application_controller/report_downloads.rb @@ -45,8 +45,8 @@ def render_pdf_internal(report) def render_pdf_internal_rr(report, result) @options = report_print_options(report, result) # used by the layouts/print render( - :template => '/layouts/print/report', - :layout => '/layouts/print', + :template => 'layouts/print/report', + :layout => 'layouts/print', :locals => { :report => report, :data => result.html_rows.join @@ -122,8 +122,8 @@ def print_report @options = report_print_options(result.report, result) # used by the layouts/print render( - :template => '/layouts/print/report', - :layout => '/layouts/print', + :template => 'layouts/print/report', + :layout => 'layouts/print', :locals => { :report => result.report, :data => result.html_rows.join @@ -231,7 +231,7 @@ def set_summary_pdf_data end disable_client_cache - render :template => '/layouts/print/textual_summary', :layout => '/layouts/print' + render :template => 'layouts/print/textual_summary', :layout => 'layouts/print' end end end diff --git a/spec/controllers/application_controller/compare_spec.rb b/spec/controllers/application_controller/compare_spec.rb index 12fa9a633f8..532cfd25b98 100644 --- a/spec/controllers/application_controller/compare_spec.rb +++ b/spec/controllers/application_controller/compare_spec.rb @@ -87,8 +87,8 @@ expect(controller).to receive(:render).with( hash_including( - :template => '/layouts/print/report', - :layout => '/layouts/print', + :template => 'layouts/print/report', + :layout => 'layouts/print', :locals => hash_including( :report # the report does not match due to a ".dup" call in the controller. ) diff --git a/spec/controllers/application_controller/report_downloads_spec.rb b/spec/controllers/application_controller/report_downloads_spec.rb index 840fff3096d..7eaca37ea8a 100644 --- a/spec/controllers/application_controller/report_downloads_spec.rb +++ b/spec/controllers/application_controller/report_downloads_spec.rb @@ -12,7 +12,7 @@ end it "returns with print" do - expect(controller).to receive(:render).with(:layout => '/layouts/print', :template => '/layouts/print/textual_summary') + expect(controller).to receive(:render).with(:layout => 'layouts/print', :template => 'layouts/print/textual_summary') controller.send(:set_summary_pdf_data) end end