aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/content_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/content_test.rb b/test/unit/content_test.rb
index f1acf054db..60fb39610b 100644
--- a/test/unit/content_test.rb
+++ b/test/unit/content_test.rb
@@ -7,6 +7,19 @@ module ActionText
assert_equal "Hello world", message.content.body.to_plain_text
end
+ test "creating a model with rich text content will not create a rich text record" do
+ message = Message.create!(subject: "Greetings")
+ assert message.content.body.nil?
+ end
+
+ test "removing content removes the rich text record" do
+ message = Message.create!(subject: "Greetings", content: "<h1>Hello world</h1>")
+
+ assert_difference -> { ActionText::RichText.all.count }, -1 do
+ message.update!(content: "")
+ end
+ end
+
test "embed extraction" do
blob = create_file_blob(filename: "racecar.jpg", content_type: "image/jpg")
message = Message.create!(subject: "Greetings", content: ActionText::Content.new("Hello world").append_attachables(blob))