gitlab-org--gitlab-foss/spec/factories/wiki_pages.rb

30 lines
630 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-04-15 00:47:09 -04:00
require 'ostruct'
FactoryBot.define do
2016-04-15 00:47:09 -04:00
factory :wiki_page do
transient do
attrs do
{
2019-01-15 02:59:17 -05:00
title: 'Title.with.dot',
content: 'Content for wiki page',
format: 'markdown'
}
end
end
page { OpenStruct.new(url_path: 'some-name') }
2016-04-15 00:47:09 -04:00
association :wiki, factory: :project_wiki, strategy: :build
initialize_with { new(wiki, page, true) }
before(:create) do |wiki_page, evaluator|
wiki_page.attributes = evaluator.attrs.with_indifferent_access
end
to_create do |wiki_page|
wiki_page.create
end
2016-04-15 00:47:09 -04:00
end
end