diff options
-rw-r--r-- | app/models/wiki_page.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/fj-50890-fix-commit-message-wiki-new-page.yml | 5 | ||||
-rw-r--r-- | spec/models/wiki_page_spec.rb | 23 |
3 files changed, 23 insertions, 7 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index c5e349ae913..ae7fb5f962a 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -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 diff --git a/changelogs/unreleased/fj-50890-fix-commit-message-wiki-new-page.yml b/changelogs/unreleased/fj-50890-fix-commit-message-wiki-new-page.yml new file mode 100644 index 00000000000..5add6d727ac --- /dev/null +++ b/changelogs/unreleased/fj-50890-fix-commit-message-wiki-new-page.yml @@ -0,0 +1,5 @@ +--- +title: Fix bug with wiki page create message +merge_request: 22849 +author: +type: fixed diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 821946a47e5..b87a2d871e5 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -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 |