From 627f69738f27a26928c7bdce4628984d59faa007 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Thu, 23 Mar 2023 02:47:14 +0100 Subject: [PATCH] DEV: Capture output in hashtags spec (#20773) --- lib/tasks/hashtags.rake | 4 ++-- spec/tasks/hashtags_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/hashtags.rake b/lib/tasks/hashtags.rake index 9810e653b78..f2c8a2ddd7b 100644 --- a/lib/tasks/hashtags.rake +++ b/lib/tasks/hashtags.rake @@ -6,10 +6,10 @@ task "hashtags:mark_old_format_for_rebake" => :environment do # on a schedule. puts "Finding posts matching old format, this could take some time..." posts_to_rebake = Post.where("cooked like '%class=\"hashtag\"%'") - STDOUT.puts( + puts( "[!] You are about to mark #{posts_to_rebake.count} posts containing hashtags in the old format to rebake. [CTRL+c] to cancel, [ENTER] to continue", ) STDIN.gets.chomp if !Rails.env.test? posts_to_rebake.update_all(baked_version: 0) - puts "Done, rebakes will happen when periodal updates job runs." + puts "Done, rebakes will happen when periodical updates job runs." end diff --git a/spec/tasks/hashtags_spec.rb b/spec/tasks/hashtags_spec.rb index 0186174da3a..679f3e0e563 100644 --- a/spec/tasks/hashtags_spec.rb +++ b/spec/tasks/hashtags_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "tasks/hashtags" do post_3 = Fabricate(:post, raw: "This is a cool #support hashtag") SiteSetting.enable_experimental_hashtag_autocomplete = false - Rake::Task["hashtags:mark_old_format_for_rebake"].invoke + capture_stdout { Rake::Task["hashtags:mark_old_format_for_rebake"].invoke } [post_1, post_2, post_3].each(&:reload)