Skip to content

Commit

Permalink
Reload before checking for related EssenceNodes
Browse files Browse the repository at this point in the history
The most recent version of AwesomeNestedSet stops reloading `self` when
saving. This leads to `self` having inaccurate values for `lft` and
`rgt` in our spec, making `node.self_and_descendants` sometimes not find all
children.

Luckily our specs found this.
  • Loading branch information
mamhoff committed Jun 23, 2020
1 parent 36ee497 commit 9565b37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/models/alchemy/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module Alchemy
let!(:parent_node) { create(:alchemy_node, children: [node]) }

it "does not destroy the node and children either but adds an error" do
parent_node.destroy
parent_node.reload.destroy
expect(parent_node).not_to be_destroyed
expect(parent_node.errors.full_messages).to eq(["This menu item is in use inside an Alchemy element on the following pages: #{page.name}."])
end
Expand Down

0 comments on commit 9565b37

Please sign in to comment.