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
|
|
|
|
{
|
|
|
|
title: 'Title',
|
|
|
|
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
|
|
|
|
|
|
|
before(:create) do |page, evaluator|
|
|
|
|
page.attributes = evaluator.attrs
|
|
|
|
end
|
|
|
|
|
|
|
|
to_create do |page|
|
|
|
|
page.create
|
|
|
|
end
|
2016-04-15 00:47:09 -04:00
|
|
|
end
|
|
|
|
end
|