mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
6e161d3e75
The most common thing that we do with fab! is: fab!(:thing) { Fabricate(:thing) } This commit adds a shorthand for this which is just simply: fab!(:thing) i.e. If you omit the block, then, by default, you'll get a `Fabricate`d object using the fabricator of the same name.
38 lines
1.0 KiB
Ruby
38 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::CleanUpUserExportTopics do
|
|
fab!(:user)
|
|
|
|
it "should delete ancient user export system messages" do
|
|
post_en =
|
|
SystemMessage.create_from_system_user(
|
|
user,
|
|
:csv_export_succeeded,
|
|
download_link: "http://example.com/download",
|
|
file_name: "xyz_en.gz",
|
|
file_size: "55",
|
|
export_title: "user_archive",
|
|
)
|
|
topic_en = post_en.topic
|
|
topic_en.update!(created_at: 5.days.ago)
|
|
|
|
I18n.locale = :fr
|
|
post_fr =
|
|
SystemMessage.create_from_system_user(
|
|
user,
|
|
:csv_export_succeeded,
|
|
download_link: "http://example.com/download",
|
|
file_name: "xyz_fr.gz",
|
|
file_size: "56",
|
|
export_title: "user_archive",
|
|
)
|
|
topic_fr = post_fr.topic
|
|
topic_fr.update!(created_at: 5.days.ago)
|
|
|
|
described_class.new.execute_onceoff({})
|
|
|
|
expect(Topic.with_deleted.exists?(id: topic_en.id)).to eq(false)
|
|
expect(Topic.with_deleted.exists?(id: topic_fr.id)).to eq(false)
|
|
end
|
|
end
|