From 0aac4caf45a413fce98fd34f81864f9aaa9799ac Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 11 Feb 2023 16:38:47 +0100 Subject: [PATCH] Register test routes in routes.rb --- config/routes.rb | 6 ++++++ spec/controllers/concerns/turbo_streamable_spec.rb | 10 ---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 74ebc5b0..d331abbd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -171,5 +171,11 @@ Rails.application.routes.draw do get "/nodeinfo/2.1", to: "well_known/node_info#nodeinfo", as: :node_info + if Rails.env.test? + get "turbo_streamable" => "turbo_streamable_test#create" + get "turbo_streamable_blocked" => "turbo_streamable_test#blocked" + get "turbo_streamable_not_found" => "turbo_streamable_test#not_found" + end + puts "processing time of routes.rb: #{"#{(Time.zone.now - start).round(3).to_s.ljust(5, '0')}s".light_green}" end diff --git a/spec/controllers/concerns/turbo_streamable_spec.rb b/spec/controllers/concerns/turbo_streamable_spec.rb index fc285d30..6c1facdf 100644 --- a/spec/controllers/concerns/turbo_streamable_spec.rb +++ b/spec/controllers/concerns/turbo_streamable_spec.rb @@ -29,16 +29,6 @@ end describe TurboStreamableTestController, type: :controller do render_views - before do - routes.disable_clear_and_finalize = true - routes.draw do - get "turbo_streamable" => "turbo_streamable_test#create" - get "turbo_streamable_blocked" => "turbo_streamable_test#blocked" - get "turbo_streamable_not_found" => "turbo_streamable_test#not_found" - end - routes.finalize! - end - shared_examples_for "it returns a toast as Turbo Stream response" do |action, message| subject { get action, format: :turbo_stream }