Skip to content

Commit

Permalink
Merge pull request #47 from AlchemyCMS/add-sanitized-body
Browse files Browse the repository at this point in the history
Serialize the new sanitized_body column from Alchemy
  • Loading branch information
mamhoff authored Mar 26, 2021
2 parents 167f0a9 + 4cad292 commit 3baa217
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class EssenceRichtextSerializer
include EssenceSerializer
attributes(
:body,
:sanitized_body,
:stripped_body,
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
let(:content) { FactoryBot.create(:alchemy_content, element: element) }
let(:essence) do
Alchemy::EssenceRichtext.create(
body: "<h3>Hello</h3>",
stripped_body: "Hello",
body: "<h3 style=\"color: red;\">Hello</h3>",
content: content,
)
end
Expand All @@ -21,7 +20,8 @@
subject { serializer.serializable_hash[:data][:attributes] }

it "has the right keys and values" do
expect(subject[:body]).to eq("<h3>Hello</h3>")
expect(subject[:body]).to eq("<h3 style=\"color: red;\">Hello</h3>")
expect(subject[:sanitized_body]).to eq("<h3>Hello</h3>")
expect(subject[:stripped_body]).to eq("Hello")
end
end
Expand Down

0 comments on commit 3baa217

Please sign in to comment.