BigW Consortium Gitlab

wiki_pages.rb 547 Bytes
Newer Older
Sebastian Klier committed
1 2 3 4
require 'ostruct'

FactoryGirl.define do
  factory :wiki_page do
5 6 7 8 9 10 11 12 13 14
    transient do
      attrs do
        {
          title: 'Title',
          content: 'Content for wiki page',
          format: 'markdown'
        }
      end
    end

15
    page { OpenStruct.new(url_path: 'some-name') }
Sebastian Klier committed
16 17
    association :wiki, factory: :project_wiki, strategy: :build
    initialize_with { new(wiki, page, true) }
18 19 20 21 22 23 24 25

    before(:create) do |page, evaluator|
      page.attributes = evaluator.attrs
    end

    to_create do |page|
      page.create
    end
Sebastian Klier committed
26 27
  end
end