Skip to content

Commit

Permalink
Fix account test (#1272)
Browse files Browse the repository at this point in the history
* Generate title for generic pages in Spina::Page factory

* Correct the failing account_test

* Compare IDs, rather than objects because json_attributes aren't guaranteed to be in the same order
  • Loading branch information
vanillaHafer authored Jul 26, 2023
1 parent b45196b commit 30028de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/factories/pages.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FactoryBot.define do
factory :page, class: "Spina::Page" do
sequence(:title) { |n| "Page #{n}" }
draft { false }
active { true }

Expand Down
4 changes: 2 additions & 2 deletions test/models/spina/account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def setup
end

test "after_save callback to bootstrap_pages creates nested pages" do
parent_page = FactoryBot.create :parent_page
parent_page = FactoryBot.create :page, name: "parent"
@theme.custom_pages << {name: "child", title: "Child", deletable: true, view_template: "child_page", parent: parent_page.name}
@account.save
child_page = Spina::Page.find_by(name: "child")

assert_equal child_page.parent, parent_page
assert_equal child_page.parent.id, parent_page.id
end

test "after_save callback to bootstrap_pages deactivates pages with unused templates" do
Expand Down

0 comments on commit 30028de

Please sign in to comment.