Files
discourse/spec/tasks/destroy_spec.rb
Ted Johansson 828fcb1ad3 DEV: Add rake task to bulk delete posts (#31642)
Same as #31576, but in that one I added some support files that turned out to be unnecessary and broke the build. So this is the re-do. 🙏
2025-03-05 09:31:23 +08:00

17 lines
412 B
Ruby

# frozen_string_literal: true
describe "destroy:posts" do
it "accepts a list of post IDs piped through STDIN" do
destroy_task = instance_spy(DestroyTask)
DestroyTask.stubs(:new).returns(destroy_task)
STDIN.stubs(:read).returns("1,2,3\n")
capture_stdout do
invoke_rake_task("destroy:posts")
expect(destroy_task).to have_received(:destroy_posts).with(%w[1 2 3])
end
end
end