2019-10-30 13:54:35 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe "incoming emails tasks" do
|
|
|
|
describe "email with attachment" do
|
|
|
|
fab!(:incoming_email) { Fabricate(:incoming_email, raw: email(:attached_txt_file)) }
|
|
|
|
|
|
|
|
it "updates record" do
|
2024-11-20 12:17:36 +08:00
|
|
|
expect { invoke_rake_task("incoming_emails:truncate_long") }.to change {
|
2019-10-30 13:54:35 +08:00
|
|
|
incoming_email.reload.raw
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "short email without attachment" do
|
|
|
|
fab!(:incoming_email) { Fabricate(:incoming_email, raw: email(:html_reply)) }
|
2024-11-20 12:17:36 +08:00
|
|
|
|
2019-10-30 13:54:35 +08:00
|
|
|
it "does not update record" do
|
2024-11-20 12:17:36 +08:00
|
|
|
expect { invoke_rake_task("incoming_emails:truncate_long") }.not_to change {
|
2019-10-30 13:54:35 +08:00
|
|
|
incoming_email.reload.raw
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|