Merge branch 'fix_wiki_commit_message' into 'master'

Fix wiki commit message

Closes #20389

See merge request !10464
This commit is contained in:
Sean McGivern 2017-04-05 08:34:50 +00:00
commit 65ea732cfe
4 changed files with 33 additions and 1 deletions

View file

@ -1,3 +1,5 @@
- commit_message = @page.persisted? ? "Update #{@page.title}" : "Create #{@page.title}"
= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form common-note-form prepend-top-default js-quick-submit' } do |f|
= form_errors(@page)
@ -28,7 +30,7 @@
.form-group
= f.label :commit_message, class: 'control-label'
.col-sm-10= f.text_field :message, class: 'form-control', rows: 18
.col-sm-10= f.text_field :message, class: 'form-control', rows: 18, value: commit_message
.form-actions
- if @page && @page.persisted?

View file

@ -0,0 +1,4 @@
---
title: Fix wiki commit message
merge_request: 10464
author: blackst0ne

View file

@ -15,6 +15,10 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
let(:project) { create(:project, namespace: user.namespace) }
context 'when wiki is empty' do
scenario 'commit message field has value "Create home"' do
expect(page).to have_field('wiki[message]', with: 'Create home')
end
scenario 'directly from the wiki home page' do
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page'
@ -37,6 +41,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'foo'
click_button 'Create Page'
# Commit message field should have correct value.
expect(page).to have_field('wiki[message]', with: 'Create foo')
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page'
@ -51,6 +58,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'Spaces in the name'
click_button 'Create Page'
# Commit message field should have correct value.
expect(page).to have_field('wiki[message]', with: 'Create spaces in the name')
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page'
@ -65,6 +75,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'hyphens-in-the-name'
click_button 'Create Page'
# Commit message field should have correct value.
expect(page).to have_field('wiki[message]', with: 'Create hyphens in the name')
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page'
@ -80,6 +93,10 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
let(:project) { create(:project, namespace: create(:group, :public)) }
context 'when wiki is empty' do
scenario 'commit message field has value "Create home"' do
expect(page).to have_field('wiki[message]', with: 'Create home')
end
scenario 'directly from the wiki home page' do
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page'
@ -101,6 +118,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'foo'
click_button 'Create Page'
# Commit message field should have correct value.
expect(page).to have_field('wiki[message]', with: 'Create foo')
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page'

View file

@ -19,6 +19,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do
scenario 'success when the wiki content is not empty' do
click_link 'Edit'
# Commit message field should have correct value.
expect(page).to have_field('wiki[message]', with: 'Update home')
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Save changes'
@ -48,6 +51,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do
scenario 'the home page' do
click_link 'Edit'
# Commit message field should have correct value.
expect(page).to have_field('wiki[message]', with: 'Update home')
fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Save changes'