Commit 5407ed81 authored by James Lopez's avatar James Lopez

Merge branch 'wiki-model-specs-instance-variables' into 'master'

Clean up wiki model specs

Closes #213982

See merge request gitlab-org/gitlab!30158
parents 44b4bab3 9e235dc4
......@@ -38,7 +38,7 @@ describe API::Search do
context 'for wiki_blobs scope', :sidekiq_might_not_need_inline do
before do
wiki = create(:project_wiki, project: project)
create(:wiki_page, wiki: wiki, attrs: { title: 'home', content: "Awesome page" })
create(:wiki_page, wiki: wiki, title: 'home', content: "Awesome page")
project.wiki.index_wiki_blobs
ensure_elasticsearch_index!
......@@ -183,7 +183,7 @@ describe API::Search do
context 'for wiki_blobs scope' do
before do
wiki = create(:project_wiki, project: project)
create(:wiki_page, wiki: wiki, attrs: { title: 'home', content: "Awesome page" })
create(:wiki_page, wiki: wiki, title: 'home', content: "Awesome page")
get api(endpoint, user), params: { scope: 'wiki_blobs', search: 'awesome' }
end
......
......@@ -84,7 +84,7 @@ describe SearchController do
with_them do
it do
project_wiki = create(:project_wiki, project: project, user: user)
create(:wiki_page, wiki: project_wiki, attrs: { title: 'merge', content: 'merge' })
create(:wiki_page, wiki: project_wiki, title: 'merge', content: 'merge')
expect(subject).to render_template("search/results/#{partial}")
end
......
......@@ -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
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Projects > Wiki > User previews markdown changes', :js do
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :wiki_repo, namespace: user.namespace) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' }) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, title: 'home', content: '[some link](other-page)') }
let(:wiki_content) do
<<-HEREDOC
[regular link](regular)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Wiki shortcuts', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :wiki_repo, namespace: user.namespace) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: 'Home page' }) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, title: 'home', content: 'Home page') }
before do
sign_in(user)
......
......@@ -195,7 +195,7 @@ describe "User creates wiki page" do
context "when wiki is not empty", :js do
before do
create(:wiki_page, wiki: wiki, attrs: { title: 'home', content: 'Home page' })
create(:wiki_page, wiki: wiki, title: 'home', content: 'Home page')
visit(project_wikis_path(project))
end
......@@ -304,8 +304,8 @@ describe "User creates wiki page" do
describe 'sidebar feature' do
context 'when there are some existing pages' do
before do
create(:wiki_page, wiki: wiki, attrs: { title: 'home', content: 'home' })
create(:wiki_page, wiki: wiki, attrs: { title: 'another', content: 'another' })
create(:wiki_page, wiki: wiki, title: 'home', content: 'home')
create(:wiki_page, wiki: wiki, title: 'another', content: 'another')
end
it 'renders a default sidebar when there is no customized sidebar' do
......@@ -316,7 +316,7 @@ describe "User creates wiki page" do
context 'when there is a customized sidebar' do
before do
create(:wiki_page, wiki: wiki, attrs: { title: '_sidebar', content: 'My customized sidebar' })
create(:wiki_page, wiki: wiki, title: '_sidebar', content: 'My customized sidebar')
end
it 'renders my customized sidebar instead of the default one' do
......@@ -330,8 +330,8 @@ describe "User creates wiki page" do
context 'when there are more than 15 existing pages' do
before do
create(:wiki_page, wiki: wiki, attrs: { title: 'home', content: 'home' })
(1..14).each { |i| create(:wiki_page, wiki: wiki, attrs: { title: "page-#{i}", content: "page #{i}" }) }
create(:wiki_page, wiki: wiki, title: 'home', content: 'home')
(1..14).each { |i| create(:wiki_page, wiki: wiki, title: "page-#{i}", content: "page #{i}") }
end
it 'renders a default sidebar when there is no customized sidebar' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Projects > Wiki > User views Git access wiki page' do
let(:user) { create(:user) }
let(:project) { create(:project, :wiki_repo, :public) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' }) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, title: 'home', content: '[some link](other-page)') }
before do
sign_in(user)
......
......@@ -64,7 +64,7 @@ describe 'User updates wiki page' do
context 'when wiki is not empty' do
let(:project_wiki) { create(:project_wiki, project: project, user: project.creator) }
let!(:wiki_page) { create(:wiki_page, wiki: project_wiki, attrs: { title: 'home', content: 'Home page' }) }
let!(:wiki_page) { create(:wiki_page, wiki: project_wiki, title: 'home', content: 'Home page') }
before do
visit(project_wikis_path(project))
......@@ -168,7 +168,7 @@ describe 'User updates wiki page' do
let(:project_wiki) { create(:project_wiki, project: project, user: project.creator) }
let(:page_name) { 'page_name' }
let(:page_dir) { "foo/bar/#{page_name}" }
let!(:wiki_page) { create(:wiki_page, wiki: project_wiki, attrs: { title: page_dir, content: 'Home page' }) }
let!(:wiki_page) { create(:wiki_page, wiki: project_wiki, title: page_dir, content: 'Home page') }
before do
visit(project_wiki_edit_path(project, wiki_page))
......
......@@ -21,7 +21,7 @@ describe 'Projects > Wiki > User views wiki in project page' do
context 'when wiki homepage contains a link' do
before do
create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' })
create(:wiki_page, wiki: project.wiki, title: 'home', content: '[some link](other-page)')
end
it 'displays the correct URL for the link' do
......
......@@ -11,7 +11,7 @@ describe 'User views a wiki page' do
let(:wiki_page) do
create(:wiki_page,
wiki: project.wiki,
attrs: { title: 'home', content: "Look at this [image](#{path})\n\n ![alt text](#{path})" })
title: 'home', content: "Look at this [image](#{path})\n\n ![alt text](#{path})")
end
before do
......
......@@ -9,13 +9,13 @@ describe 'User views wiki pages' do
let(:project) { create(:project, :wiki_repo, namespace: user.namespace) }
let!(:wiki_page1) do
create(:wiki_page, wiki: project.wiki, attrs: { title: '3 home', content: '3' })
create(:wiki_page, wiki: project.wiki, title: '3 home', content: '3')
end
let!(:wiki_page2) do
create(:wiki_page, wiki: project.wiki, attrs: { title: '1 home', content: '1' })
create(:wiki_page, wiki: project.wiki, title: '1 home', content: '1')
end
let!(:wiki_page3) do
create(:wiki_page, wiki: project.wiki, attrs: { title: '2 home', content: '2' })
create(:wiki_page, wiki: project.wiki, title: '2 home', content: '2')
end
let(:pages) do
......
......@@ -16,7 +16,7 @@ describe 'User views AsciiDoc page with includes', :js do
format: :asciidoc
}
create(:wiki_page, wiki: project.wiki, attrs: attrs)
create(:wiki_page, wiki: project.wiki, **attrs)
end
before do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'User searches for wiki pages', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :repository, :wiki_repo, namespace: user.namespace) }
let!(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'directory/title', content: 'Some Wiki content' }) }
let!(:wiki_page) { create(:wiki_page, wiki: project.wiki, title: 'directory/title', content: 'Some Wiki content') }
before do
project.add_maintainer(user)
......
......@@ -57,7 +57,7 @@ describe Banzai::Pipeline::WikiPipeline do
let(:namespace) { create(:namespace, name: "wiki_link_ns") }
let(:project) { create(:project, :public, name: "wiki_link_project", namespace: namespace) }
let(:project_wiki) { ProjectWiki.new(project, double(:user)) }
let(:page) { build(:wiki_page, wiki: project_wiki, page: OpenStruct.new(url_path: 'nested/twice/start-page')) }
let(:page) { build(:wiki_page, wiki: project_wiki, title: 'nested/twice/start-page') }
{ 'when GitLab is hosted at a root URL' => '',
'when GitLab is hosted at a relative URL' => '/nested/relative/gitlab' }.each do |test_name, relative_url_root|
......@@ -264,7 +264,7 @@ describe Banzai::Pipeline::WikiPipeline do
let_it_be(:namespace) { create(:namespace, name: "wiki_link_ns") }
let_it_be(:project) { create(:project, :public, name: "wiki_link_project", namespace: namespace) }
let_it_be(:project_wiki) { ProjectWiki.new(project, double(:user)) }
let_it_be(:page) { build(:wiki_page, wiki: project_wiki, page: OpenStruct.new(url_path: 'nested/twice/start-page')) }
let_it_be(:page) { build(:wiki_page, wiki: project_wiki, title: 'nested/twice/start-page') }
it 'generates video html structure' do
markdown = "![video_file](video_file_name.mp4)"
......
......@@ -40,7 +40,7 @@ describe BlobViewer::Readme do
context 'when the wiki is not empty' do
before do
create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: 'Home page' })
create(:wiki_page, wiki: project.wiki, title: 'home', content: 'Home page')
end
it 'returns nil' do
......
......@@ -490,7 +490,7 @@ describe Event do
context 'for a wiki page event' do
let(:wiki_page) do
create(:wiki_page, :with_real_page, project: project)
create(:wiki_page, project: project)
end
subject(:event) { create(:wiki_page_event, project: project, wiki_page: wiki_page) }
......
......@@ -121,7 +121,7 @@ describe MicrosoftTeamsService do
message: "user created page: Awesome wiki_page"
}
end
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: opts) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, **opts) }
let(:wiki_page_sample_data) { Gitlab::DataBuilder::WikiPage.build(wiki_page, user, 'create') }
it "calls Microsoft Teams API" do
......
......@@ -6,17 +6,8 @@ describe WikiPage do
let_it_be(:user) { create(:user) }
let(:container) { create(:project, :wiki_repo) }
let(:wiki) { Wiki.for_container(container, user) }
let(:new_page) do
described_class.new(wiki).tap do |page|
page.attributes = { title: 'test page', content: 'test content' }
end
end
let(:existing_page) do
create_page('test page', 'test content')
wiki.find_page('test page')
end
let(:new_page) { build(:wiki_page, wiki: wiki, title: 'test page', content: 'test content') }
let(:existing_page) { create(:wiki_page, wiki: wiki, title: 'test page', content: 'test content', message: 'test commit') }
subject { new_page }
......@@ -41,13 +32,13 @@ describe WikiPage do
context 'when there are pages' do
before do
create_page('dir_1/dir_1_1/page_3', 'content')
create_page('page_1', 'content')
create_page('dir_1/page_2', 'content')
create_page('dir_2', 'page with dir name')
create_page('dir_2/page_5', 'content')
create_page('page_6', 'content')
create_page('dir_2/page_4', 'content')
wiki.create_page('dir_1/dir_1_1/page_3', 'content')
wiki.create_page('page_1', 'content')
wiki.create_page('dir_1/page_2', 'content')
wiki.create_page('dir_2', 'page with dir name')
wiki.create_page('dir_2/page_5', 'content')
wiki.create_page('page_6', 'content')
wiki.create_page('dir_2/page_4', 'content')
end
let(:page_1) { wiki.find_page('page_1') }
......@@ -353,7 +344,7 @@ describe WikiPage do
context 'with an existing page title exceeding the limit' do
subject do
title = 'a' * (max_title + 1)
create_page(title, 'content')
wiki.create_page(title, 'content')
wiki.find_page(title)
end
......@@ -397,6 +388,20 @@ describe WikiPage do
expect(wiki.find_page("Index").message).to eq 'Custom Commit Message'
end
it 'if the title is preceded by a / it is removed' do
subject.create(attributes.merge(title: '/New Page'))
expect(wiki.find_page('New Page')).not_to be_nil
end
end
context "with invalid attributes" do
it 'does not create the page' do
subject.create(title: '')
expect(wiki.find_page('New Page')).to be_nil
end
end
end
......@@ -419,14 +424,11 @@ describe WikiPage do
end
end
describe "#update" do
subject do
create_page(title, "content")
wiki.find_page(title)
end
describe '#update' do
subject { create(:wiki_page, wiki: wiki, title: title) }
it "updates the content of the page" do
subject.update(content: "new content")
it 'updates the content of the page' do
subject.update(content: 'new content')
page = wiki.find_page(title)
expect([subject.content, page.content]).to all(eq('new content'))
......@@ -438,24 +440,6 @@ describe WikiPage do
end
end
describe '#create' do
context 'with valid attributes' do
it 'raises an error if a page with the same path already exists' do
create_page('New Page', 'content')
create_page('foo/bar', 'content')
expect { create_page('New Page', 'other content') }.to raise_error Gitlab::Git::Wiki::DuplicatePageError
expect { create_page('foo/bar', 'other content') }.to raise_error Gitlab::Git::Wiki::DuplicatePageError
end
it 'if the title is preceded by a / it is removed' do
create_page('/New Page', 'content')
expect(wiki.find_page('New Page')).not_to be_nil
end
end
end
describe "#update" do
subject { existing_page }
......@@ -573,7 +557,7 @@ describe WikiPage do
context 'when renaming a page' do
it 'raises an error if the page already exists' do
create_page('Existing Page', 'content')
wiki.create_page('Existing Page', 'content')
expect { subject.update(title: 'Existing Page', content: 'new_content') }.to raise_error(WikiPage::PageRenameError)
expect(subject.title).to eq 'test page'
......@@ -595,7 +579,7 @@ describe WikiPage do
context 'when moving a page' do
it 'raises an error if the page already exists' do
create_page('foo/Existing Page', 'content')
wiki.create_page('foo/Existing Page', 'content')
expect { subject.update(title: 'foo/Existing Page', content: 'new_content') }.to raise_error(WikiPage::PageRenameError)
expect(subject.title).to eq 'test page'
......@@ -615,10 +599,7 @@ describe WikiPage do
end
context 'in subdir' do
subject do
create_page('foo/Existing Page', 'content')
wiki.find_page('foo/Existing Page')
end
subject { create(:wiki_page, wiki: wiki, title: 'foo/Existing Page') }
it 'moves the page to the root folder if the title is preceded by /' do
expect(subject.slug).to eq 'foo/Existing-Page'
......@@ -656,7 +637,7 @@ describe WikiPage do
end
end
describe "#destroy" do
describe "#delete" do
subject { existing_page }
it "deletes the page" do
......@@ -688,10 +669,7 @@ describe WikiPage do
using RSpec::Parameterized::TableSyntax
let(:untitled_page) { described_class.new(wiki) }
let(:directory_page) do
create_page('parent directory/child page', 'test content')
wiki.find_page('parent directory/child page')
end
let(:directory_page) { create(:wiki_page, title: 'parent directory/child page') }
where(:page, :title, :changed) do
:untitled_page | nil | false
......@@ -754,10 +732,7 @@ describe WikiPage do
end
context 'when the page is inside an actual directory' do
subject do
create_page('dir_1/dir_1_1/file', 'content')
wiki.find_page('dir_1/dir_1_1/file')
end
subject { create(:wiki_page, title: 'dir_1/dir_1_1/file') }
it 'returns the full directory hierarchy' do
expect(subject.directory).to eq('dir_1/dir_1_1')
......@@ -804,6 +779,16 @@ describe WikiPage do
end
end
describe '#persisted?' do
it 'returns true for a persisted page' do
expect(existing_page).to be_persisted
end
it 'returns false for an unpersisted page' do
expect(new_page).not_to be_persisted
end
end
describe '#to_partial_path' do
it 'returns the relative path to the partial to be used' do
expect(subject.to_partial_path).to eq('projects/wikis/wiki_page')
......@@ -886,18 +871,6 @@ describe WikiPage do
private
def remove_temp_repo(path)
FileUtils.rm_rf path
end
def commit_details
Gitlab::Git::Wiki::CommitDetails.new(user.id, user.username, user.name, user.email, "test commit")
end
def create_page(name, content)
wiki.wiki.write_page(name, :markdown, content, commit_details)
end
def get_slugs(page_or_dir)
if page_or_dir.is_a? WikiPage
[page_or_dir.slug]
......
......@@ -401,7 +401,7 @@ describe API::Search do
context 'for wiki_blobs scope' do
before do
wiki = create(:project_wiki, project: project)
create(:wiki_page, wiki: wiki, attrs: { title: 'home', content: "Awesome page" })
create(:wiki_page, wiki: wiki, title: 'home', content: "Awesome page")
get api("/projects/#{project.id}/search", user), params: { scope: 'wiki_blobs', search: 'awesome' }
end
......
......@@ -25,8 +25,8 @@ describe API::Wikis do
shared_examples_for 'returns list of wiki pages' do
context 'when wiki has pages' do
let!(:pages) do
[create(:wiki_page, wiki: project_wiki, attrs: { title: 'page1', content: 'content of page1' }),
create(:wiki_page, wiki: project_wiki, attrs: { title: 'page2.with.dot', content: 'content of page2' })]
[create(:wiki_page, wiki: project_wiki, title: 'page1', content: 'content of page1'),
create(:wiki_page, wiki: project_wiki, title: 'page2.with.dot', content: 'content of page2')]
end
it 'returns the list of wiki pages without content' do
......
......@@ -198,7 +198,7 @@ RSpec.shared_examples "chat service" do |service_name|
message: "user created page: Awesome wiki_page"
}
end
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: opts) }
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, **opts) }
let(:sample_data) { Gitlab::DataBuilder::WikiPage.build(wiki_page, user, "create") }
it_behaves_like "triggered #{service_name} service"
......
......@@ -112,7 +112,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
message: "user created page: Awesome wiki_page"
}
@wiki_page = create(:wiki_page, wiki: project.wiki, attrs: opts)
@wiki_page = create(:wiki_page, wiki: project.wiki, **opts)
@wiki_page_sample_data = Gitlab::DataBuilder::WikiPage.build(@wiki_page, user, 'create')
end
......
......@@ -95,13 +95,14 @@ RSpec.shared_examples 'wiki model' do
let(:wiki_pages) { subject.list_pages }
before do
create_page('index', 'This is an index')
create_page('index2', 'This is an index2')
create_page('an index3', 'This is an index3')
subject.create_page('index', 'This is an index')
subject.create_page('index2', 'This is an index2')
subject.create_page('an index3', 'This is an index3')
end
it 'returns an array of WikiPage instances' do
expect(wiki_pages.first).to be_a WikiPage
expect(wiki_pages).to be_present
expect(wiki_pages).to all(be_a(WikiPage))
end
it 'does not load WikiPage content by default' do
......@@ -149,7 +150,7 @@ RSpec.shared_examples 'wiki model' do
describe '#find_page' do
before do
create_page('index page', 'This is an awesome Gollum Wiki')
subject.create_page('index page', 'This is an awesome Gollum Wiki')
end
it 'returns the latest version of the page if it exists' do
......@@ -176,7 +177,7 @@ RSpec.shared_examples 'wiki model' do
context 'pages with multibyte-character title' do
before do
create_page('autre pagé', "C'est un génial Gollum Wiki")
subject.create_page('autre pagé', "C'est un génial Gollum Wiki")
end
it 'can find a page by slug' do
......@@ -188,7 +189,7 @@ RSpec.shared_examples 'wiki model' do
context 'pages with invalidly-encoded content' do
before do
create_page('encoding is fun', "f\xFCr".b)
subject.create_page('encoding is fun', "f\xFCr".b)
end
it 'can find the page' do
......@@ -201,11 +202,11 @@ RSpec.shared_examples 'wiki model' do
describe '#find_sidebar' do
before do
create_page(described_class::SIDEBAR, 'This is an awesome Sidebar')
subject.create_page(described_class::SIDEBAR, 'This is an awesome Sidebar')
end
it 'finds the page defined as _sidebar' do
page = subject.find_page('_sidebar')
page = subject.find_sidebar
expect(page.content).to eq('This is an awesome Sidebar')
end
......@@ -284,58 +285,59 @@ RSpec.shared_examples 'wiki model' do
end
describe '#update_page' do
before do
create_page('update-page', 'some content')
@gitlab_git_wiki_page = subject.wiki.page(title: 'update-page')
let(:page) { create(:wiki_page, wiki: subject, title: 'update-page') }
def update_page
subject.update_page(
@gitlab_git_wiki_page,
page.page,
content: 'some other content',
format: :markdown,
message: 'updated page'
)
@page = subject.list_pages(load_content: true).first.page
end
it 'updates the content of the page' do
expect(@page.raw_data).to eq('some other content')
update_page
page = subject.find_page('update-page')
expect(page.raw_content).to eq('some other content')
end
it 'sets the correct commit message' do
expect(@page.version.message).to eq('updated page')
update_page
page = subject.find_page('update-page')
expect(page.version.message).to eq('updated page')
end
it 'sets the correct commit email' do
update_page
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end
it 'updates container activity' do
page
expect(subject).to receive(:update_container_activity)
subject.update_page(
@gitlab_git_wiki_page,
content: 'Yet more content',
format: :markdown,
message: 'Updated page again'
)
update_page
end
end
describe '#delete_page' do
before do
create_page('index', 'some content')
@page = subject.wiki.page(title: 'index')
end
let(:page) { create(:wiki_page, wiki: wiki) }
it 'deletes the page' do
subject.delete_page(@page)
subject.delete_page(page)
expect(subject.list_pages.count).to eq(0)
end
it 'sets the correct commit email' do
subject.delete_page(@page)
subject.delete_page(page)
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
......@@ -343,9 +345,11 @@ RSpec.shared_examples 'wiki model' do
end
it 'updates container activity' do
page
expect(subject).to receive(:update_container_activity)
subject.delete_page(@page)
subject.delete_page(page)
end
end
......@@ -378,23 +382,4 @@ RSpec.shared_examples 'wiki model' do
expect(subject.hook_attrs.keys).to contain_exactly(:web_url, :git_ssh_url, :git_http_url, :path_with_namespace, :default_branch)
end
end
private
def create_temp_repo(path)
FileUtils.mkdir_p path
system(*%W(#{Gitlab.config.git.bin_path} init --quiet --bare -- #{path}))
end
def remove_temp_repo(path)
FileUtils.rm_rf path
end
def commit_details
Gitlab::Git::Wiki::CommitDetails.new(user.id, user.username, user.name, user.commit_email, 'test commit')
end
def create_page(name, content)
subject.wiki.write_page(name, :markdown, content, commit_details)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment