Skip to content

Commit

Permalink
Do not expect an element to be persisted when building a content
Browse files Browse the repository at this point in the history
Rails don't need a content, and neiter do we.
  • Loading branch information
mamhoff committed Mar 26, 2021
1 parent 3197901 commit 9188b5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/alchemy/content/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def new(attributes = {})
super(
name: definition[:name],
essence_type: normalize_essence_type(definition[:type]),
element_id: element.id
element: element
).tap(&:build_essence)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/alchemy/essence_richtext_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module Alchemy
describe EssenceRichtext do
let(:element) { create(:alchemy_element, name: "article") }
let(:element) { Alchemy::Element.new(name: "article") }
let(:content) { Alchemy::Content.new(name: "text", element: element) }
let(:essence) do
Alchemy::EssenceRichtext.new(
Expand All @@ -29,7 +29,7 @@ module Alchemy
end

context "when class is not part of the allowed attributes" do
let(:element) { create(:alchemy_element, name: "text") }
let(:element) { Alchemy::Element.new(name: "text") }
let(:content) { Alchemy::Content.new(name: "text", element: element) }

it "should save a sanitized version of body column" do
Expand Down

0 comments on commit 9188b5c

Please sign in to comment.