Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-27 12:09:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-27 12:09:51 +0300
commit39fa1b598749be0aad699032bbf31450b3ff0098 (patch)
tree15a4c28989d58f9315e58458a3a494ff8cfc1525 /spec/factories/wiki_pages.rb
parenta59d305223365cb31bb670f134383d6ff316a13e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories/wiki_pages.rb')
-rw-r--r--spec/factories/wiki_pages.rb34
1 files changed, 14 insertions, 20 deletions
diff --git a/spec/factories/wiki_pages.rb b/spec/factories/wiki_pages.rb
index 8eafad07268..e5df970dc9c 100644
--- a/spec/factories/wiki_pages.rb
+++ b/spec/factories/wiki_pages.rb
@@ -7,11 +7,17 @@ FactoryBot.define do
transient do
title { generate(:wiki_page_title) }
content { 'Content for wiki page' }
- format { 'markdown' }
+ format { :markdown }
+ message { nil }
project { association(:project, :wiki_repo) }
container { project }
- attrs do
- {
+ wiki { association(:wiki, container: container) }
+ page { OpenStruct.new(url_path: title) }
+ end
+
+ initialize_with do
+ new(wiki, page).tap do |page|
+ page.attributes = {
title: title,
content: content,
format: format
@@ -19,25 +25,13 @@ FactoryBot.define do
end
end
- page { OpenStruct.new(url_path: 'some-name') }
- wiki { association(:wiki, container: container) }
-
- initialize_with { new(wiki, page) }
-
- before(:create) do |page, evaluator|
- page.attributes = evaluator.attrs
+ # Clear our default @page, except when using build_stubbed
+ after(:build) do |page|
+ page.instance_variable_set('@page', nil)
end
- to_create do |page|
- page.create
- end
-
- trait :with_real_page do
- page do
- wiki.create_page(title, content)
- page_title, page_dir = wiki.page_title_and_dir(title)
- wiki.wiki.page(title: page_title, dir: page_dir, version: nil)
- end
+ to_create do |page, evaluator|
+ page.create(message: evaluator.message)
end
end