Reviewed-on: #423 Co-authored-by: miteruzo <miteruzo@naver.com>
このコミットはプルリクエスト #423 でマージされました。
このコミットが含まれているのは:
@@ -21,7 +21,7 @@ RSpec.describe 'Wiki history integrity', type: :request do
|
||||
expect {
|
||||
post '/wiki',
|
||||
params: {
|
||||
title: 'wiki_history_create_atomic',
|
||||
title: 'Help:wiki_history_create_atomic',
|
||||
body: "a\nb\nc",
|
||||
message: 'initial commit',
|
||||
},
|
||||
@@ -37,7 +37,7 @@ RSpec.describe 'Wiki history integrity', type: :request do
|
||||
revision = page.current_revision
|
||||
version = page.wiki_versions.order(:version_no).last
|
||||
|
||||
expect(page.title).to eq('wiki_history_create_atomic')
|
||||
expect(page.title).to eq('Help:wiki_history_create_atomic')
|
||||
expect(page.body).to eq("a\nb\nc")
|
||||
|
||||
expect(revision).to be_content
|
||||
@@ -47,7 +47,7 @@ RSpec.describe 'Wiki history integrity', type: :request do
|
||||
expect(version).to have_attributes(
|
||||
version_no: 1,
|
||||
event_type: 'create',
|
||||
title: 'wiki_history_create_atomic',
|
||||
title: 'Help:wiki_history_create_atomic',
|
||||
body: "a\nb\nc",
|
||||
reason: 'initial commit',
|
||||
created_by_user_id: user.id
|
||||
@@ -58,7 +58,7 @@ RSpec.describe 'Wiki history integrity', type: :request do
|
||||
expect {
|
||||
post '/wiki',
|
||||
params: {
|
||||
title: 'wiki_history_blank_body',
|
||||
title: 'Help:wiki_history_blank_body',
|
||||
body: "\r\n\r\n",
|
||||
message: 'blank',
|
||||
},
|
||||
@@ -67,16 +67,17 @@ RSpec.describe 'Wiki history integrity', type: :request do
|
||||
.not_to change(WikiPage, :count)
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(WikiPage.joins(:tag_name).where(tag_names: { name: 'wiki_history_blank_body' })).not_to exist
|
||||
expect(WikiPage.joins(:tag_name)
|
||||
.where(tag_names: { name: 'Help:wiki_history_blank_body' })).not_to exist
|
||||
end
|
||||
|
||||
it 'returns 422 and creates no partial page when title already exists' do
|
||||
create_wiki_page(title: 'wiki_history_duplicate_title', body: 'first')
|
||||
create_wiki_page(title: 'Help:wiki_history_duplicate_title', body: 'first')
|
||||
|
||||
expect {
|
||||
post '/wiki',
|
||||
params: {
|
||||
title: 'wiki_history_duplicate_title',
|
||||
title: 'Help:wiki_history_duplicate_title',
|
||||
body: 'second',
|
||||
message: 'duplicate',
|
||||
},
|
||||
@@ -85,7 +86,8 @@ RSpec.describe 'Wiki history integrity', type: :request do
|
||||
.not_to change(WikiPage, :count)
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(WikiPage.joins(:tag_name).where(tag_names: { name: 'wiki_history_duplicate_title' }).count).to eq(1)
|
||||
expect(WikiPage.joins(:tag_name)
|
||||
.where(tag_names: { name: 'Help:wiki_history_duplicate_title' }).count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする