Skip to content

A platform for community discussion. Free, open, simple.

DEV: Capture output in hashtags spec (#20773)

Jarek Radosz627f69738f27
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)