mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix content attachment test
This commit is contained in:
parent
3044312128
commit
6a77309d66
5 changed files with 27 additions and 1 deletions
7
test/dummy/app/models/person.rb
Normal file
7
test/dummy/app/models/person.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Person < ApplicationRecord
|
||||
include ActionText::Attachable
|
||||
|
||||
def to_trix_content_attachment_partial_path
|
||||
"people/trix_content_attachment"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
<span class="mentionable-person" gid="<%= person.to_gid %>">
|
||||
<%= person.name %>
|
||||
</span>
|
9
test/dummy/db/migrate/20181003185713_create_people.rb
Normal file
9
test/dummy/db/migrate/20181003185713_create_people.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class CreatePeople < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :people do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_02_12_164506) do
|
||||
ActiveRecord::Schema.define(version: 2018_10_03_185713) do
|
||||
|
||||
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
|
@ -49,4 +49,10 @@ ActiveRecord::Schema.define(version: 2018_02_12_164506) do
|
|||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "people", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -34,6 +34,7 @@ class ActionText::AttachmentTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
test "converts to TrixAttachment with content" do
|
||||
attachable = Person.create! name: "Javan"
|
||||
attachment = attachment_from_html(%Q(<action-text-attachment sgid="#{attachable.attachable_sgid}"></action-text-attachment>))
|
||||
|
||||
trix_attachment = attachment.to_trix_attachment
|
||||
|
|
Loading…
Reference in a new issue