Commit 7d43484d authored by blackst0ne's avatar blackst0ne

Fix wiki commit message

parent d9aca741
- 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_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) = form_errors(@page)
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
.form-group .form-group
= f.label :commit_message, class: 'control-label' = 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 .form-actions
- if @page && @page.persisted? - if @page && @page.persisted?
......
---
title: Fix wiki commit message
merge_request: 10464
author: blackst0ne
...@@ -15,6 +15,10 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -15,6 +15,10 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
context 'when wiki is empty' do 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 scenario 'directly from the wiki home page' do
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
...@@ -37,6 +41,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -37,6 +41,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'foo' fill_in :new_wiki_path, with: 'foo'
click_button 'Create Page' 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!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
...@@ -51,6 +58,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -51,6 +58,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'Spaces in the name' fill_in :new_wiki_path, with: 'Spaces in the name'
click_button 'Create Page' 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!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
...@@ -65,6 +75,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -65,6 +75,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'hyphens-in-the-name' fill_in :new_wiki_path, with: 'hyphens-in-the-name'
click_button 'Create Page' 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!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
...@@ -80,6 +93,10 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -80,6 +93,10 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
let(:project) { create(:project, namespace: create(:group, :public)) } let(:project) { create(:project, namespace: create(:group, :public)) }
context 'when wiki is empty' do 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 scenario 'directly from the wiki home page' do
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
...@@ -101,6 +118,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -101,6 +118,9 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
fill_in :new_wiki_path, with: 'foo' fill_in :new_wiki_path, with: 'foo'
click_button 'Create Page' 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!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
......
...@@ -19,6 +19,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do ...@@ -19,6 +19,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do
scenario 'success when the wiki content is not empty' do scenario 'success when the wiki content is not empty' do
click_link 'Edit' 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!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Save changes' click_button 'Save changes'
...@@ -48,6 +51,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do ...@@ -48,6 +51,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do
scenario 'the home page' do scenario 'the home page' do
click_link 'Edit' 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!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Save changes' click_button 'Save changes'
......
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