aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-09-12 15:51:06 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-09-12 15:51:06 -0700
commit531d7dd584267e81ba57d4de7f0fe21b18a83cbb (patch)
tree1e65cf6bda11cc03bdcebdc9183a84abb5aef58c /test
parent3431c0b3eeaf284901bd9aa4265c578207d4c820 (diff)
downloadrails-531d7dd584267e81ba57d4de7f0fe21b18a83cbb.tar.gz
rails-531d7dd584267e81ba57d4de7f0fe21b18a83cbb.tar.bz2
rails-531d7dd584267e81ba57d4de7f0fe21b18a83cbb.zip
Never mind on allowing blank
More hassle than its worth. Just account for the fact that rich text can be blank instead, but continue to create the record.
Diffstat (limited to 'test')
-rw-r--r--test/dummy/db/migrate/2018052816_create_action_text_tables.rb2
-rw-r--r--test/dummy/db/schema.rb2
-rw-r--r--test/unit/content_test.rb10
3 files changed, 3 insertions, 11 deletions
diff --git a/test/dummy/db/migrate/2018052816_create_action_text_tables.rb b/test/dummy/db/migrate/2018052816_create_action_text_tables.rb
index 872987749a..ed97ad46c0 100644
--- a/test/dummy/db/migrate/2018052816_create_action_text_tables.rb
+++ b/test/dummy/db/migrate/2018052816_create_action_text_tables.rb
@@ -2,7 +2,7 @@ class CreateActionTextTables < ActiveRecord::Migration[5.2]
def change
create_table :action_text_rich_texts do |t|
t.string :name, null: false
- t.text :body, limit: 16777215, null: false
+ t.text :body, limit: 16777215
t.references :record, null: false, polymorphic: true, index: false
t.datetime :created_at, null: false
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb
index 30bf844e9c..5179d7269f 100644
--- a/test/dummy/db/schema.rb
+++ b/test/dummy/db/schema.rb
@@ -14,7 +14,7 @@ ActiveRecord::Schema.define(version: 2018_02_12_164506) do
create_table "action_text_rich_texts", force: :cascade do |t|
t.string "name", null: false
- t.text "body", limit: 16777215, null: false
+ t.text "body", limit: 16777215
t.string "record_type", null: false
t.integer "record_id", null: false
t.datetime "created_at", null: false
diff --git a/test/unit/content_test.rb b/test/unit/content_test.rb
index 60fb39610b..59beb323cf 100644
--- a/test/unit/content_test.rb
+++ b/test/unit/content_test.rb
@@ -7,19 +7,11 @@ 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
+ test "without content" 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))