2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-04-15 00:47:09 -04:00
|
|
|
require 'ostruct'
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-04-15 00:47:09 -04:00
|
|
|
factory :wiki_page do
|
2016-12-20 08:31:21 -05:00
|
|
|
transient do
|
|
|
|
attrs do
|
|
|
|
{
|
2019-01-15 02:59:17 -05:00
|
|
|
title: 'Title.with.dot',
|
2016-12-20 08:31:21 -05:00
|
|
|
content: 'Content for wiki page',
|
|
|
|
format: 'markdown'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-06-08 00:59:20 -04:00
|
|
|
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) }
|
2016-12-20 08:31:21 -05:00
|
|
|
|
2019-10-22 23:06:01 -04:00
|
|
|
before(:create) do |wiki_page, evaluator|
|
|
|
|
wiki_page.attributes = evaluator.attrs.with_indifferent_access
|
2016-12-20 08:31:21 -05:00
|
|
|
end
|
|
|
|
|
2019-10-22 23:06:01 -04:00
|
|
|
to_create do |wiki_page|
|
|
|
|
wiki_page.create
|
2016-12-20 08:31:21 -05:00
|
|
|
end
|
2016-04-15 00:47:09 -04:00
|
|
|
end
|
|
|
|
end
|