Commit e5699ae1 authored by Luke Duncalfe's avatar Luke Duncalfe Committed by Bob Van Landuyt

Optimise WikiPage spec

Locally the spec has reduced from ~45s to ~14s.

We used to spend ~35s creating 416 factories, and we now spend ~3s
creating 43 factories.
parent a9dc7769
...@@ -106,7 +106,7 @@ class Wiki ...@@ -106,7 +106,7 @@ class Wiki
[WikiDirectory.group_pages(pages), limited] [WikiDirectory.group_pages(pages), limited]
end end
# Finds a page within the repository based on a tile # Finds a page within the repository based on a title
# or slug. # or slug.
# #
# title - The human readable or parameterized title of # title - The human readable or parameterized title of
......
...@@ -4,7 +4,7 @@ FactoryBot.define do ...@@ -4,7 +4,7 @@ FactoryBot.define do
factory :wiki do factory :wiki do
transient do transient do
container { association(:project) } container { association(:project) }
user { association(:user) } user { container.default_owner || association(:user) }
end end
initialize_with { Wiki.for_container(container, user) } initialize_with { Wiki.for_container(container, user) }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment