DEV: Capture output in hashtags spec (#20773)
This commit is contained in:
parent
4cb79ce8be
commit
627f69738f
|
@ -6,10 +6,10 @@ task "hashtags:mark_old_format_for_rebake" => :environment do
|
||||||
# on a schedule.
|
# on a schedule.
|
||||||
puts "Finding posts matching old format, this could take some time..."
|
puts "Finding posts matching old format, this could take some time..."
|
||||||
posts_to_rebake = Post.where("cooked like '%class=\"hashtag\"%'")
|
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",
|
"[!] 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?
|
STDIN.gets.chomp if !Rails.env.test?
|
||||||
posts_to_rebake.update_all(baked_version: 0)
|
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
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ RSpec.describe "tasks/hashtags" do
|
||||||
post_3 = Fabricate(:post, raw: "This is a cool #support hashtag")
|
post_3 = Fabricate(:post, raw: "This is a cool #support hashtag")
|
||||||
SiteSetting.enable_experimental_hashtag_autocomplete = false
|
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)
|
[post_1, post_2, post_3].each(&:reload)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue