このコミットが含まれているのは:
@@ -1,6 +1,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Wiki title collision', type: :request do
|
||||
include WikiRecords
|
||||
let!(:user) { create_member_user! }
|
||||
|
||||
def auth_headers user
|
||||
@@ -8,7 +9,7 @@ RSpec.describe 'Wiki title collision', type: :request do
|
||||
end
|
||||
|
||||
def create_wiki_page title:, body:
|
||||
Wiki::Commit.create_content!(
|
||||
seed_wiki_page(
|
||||
tag_name: create(:tag_name, name: title),
|
||||
body:,
|
||||
created_by_user: user,
|
||||
@@ -43,20 +44,18 @@ RSpec.describe 'Wiki title collision', type: :request do
|
||||
expect(source.wiki_versions.count).to eq(source_version_count)
|
||||
end
|
||||
|
||||
it 'returns 422 when creating wiki with existing title' do
|
||||
it 'rejects frozen creation with an existing title without adding history' do
|
||||
create_wiki_page(title: 'Help:wiki_collision_create', body: 'already exists')
|
||||
|
||||
expect {
|
||||
expect do
|
||||
post '/wiki',
|
||||
params: {
|
||||
title: 'Help:wiki_collision_create',
|
||||
body: 'new body',
|
||||
message: 'duplicate create',
|
||||
},
|
||||
params: { title: 'Help:wiki_collision_create', body: 'new body',
|
||||
message: 'duplicate create' },
|
||||
headers: auth_headers(user)
|
||||
}
|
||||
.not_to change(WikiPage, :count)
|
||||
end.to change(WikiPage, :count).by(0)
|
||||
.and change(WikiRevision, :count).by(0)
|
||||
.and change(WikiVersion, :count).by(0)
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(response.status).to be_between(400, 499)
|
||||
end
|
||||
end
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする