Fix bug with wiki page create message

This commit is contained in:
Francisco Javier López 2018-11-07 08:01:59 +00:00 committed by Sean McGivern
parent 1b788c66a1
commit 8aae7405ee
3 changed files with 23 additions and 7 deletions

View File

@ -195,7 +195,7 @@ class WikiPage
update_attributes(attrs)
save(page_details: title) do
wiki.create_page(title, content, format, message)
wiki.create_page(title, content, format, attrs[:message])
end
end

View File

@ -0,0 +1,5 @@
---
title: Fix bug with wiki page create message
merge_request: 22849
author:
type: fixed

View File

@ -126,23 +126,34 @@ describe WikiPage do
end
end
before do
@wiki_attr = { title: "Index", content: "Home Page", format: "markdown" }
end
describe "#create" do
let(:wiki_attr) do
{
title: "Index",
content: "Home Page",
format: "markdown",
message: 'Custom Commit Message'
}
end
after do
destroy_page("Index")
end
context "with valid attributes" do
it "saves the wiki page" do
subject.create(@wiki_attr)
subject.create(wiki_attr)
expect(wiki.find_page("Index")).not_to be_nil
end
it "returns true" do
expect(subject.create(@wiki_attr)).to eq(true)
expect(subject.create(wiki_attr)).to eq(true)
end
it 'saves the wiki page with message' do
subject.create(wiki_attr)
expect(wiki.find_page("Index").message).to eq 'Custom Commit Message'
end
end
end