Reviewed-on: #423 Co-authored-by: miteruzo <miteruzo@naver.com>
このコミットはプルリクエスト #423 でマージされました。
このコミットが含まれているのは:
@@ -11,6 +11,12 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
let!(:user) { create_member_user! }
|
||||
|
||||
let!(:tn) { create(:tag_name, name: 'spec_wiki_title') }
|
||||
let!(:tag) do
|
||||
create(:tag,
|
||||
primary_tag_name: tn,
|
||||
category: :general,
|
||||
deprecated_at: Time.zone.local(2026, 6, 1))
|
||||
end
|
||||
let!(:page) do
|
||||
Wiki::Commit.create_content!(
|
||||
tag_name: tn,
|
||||
@@ -18,12 +24,6 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
created_by_user: user,
|
||||
message: 'init')
|
||||
end
|
||||
let!(:tag) do
|
||||
create(:tag,
|
||||
primary_tag_name: tn,
|
||||
category: :general,
|
||||
deprecated_at: Time.zone.local(2026, 6, 1))
|
||||
end
|
||||
|
||||
describe 'GET /wiki' do
|
||||
it 'returns wiki pages with title' do
|
||||
@@ -111,7 +111,7 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
context 'when success' do
|
||||
it 'creates wiki_page and first content revision' do
|
||||
expect do
|
||||
post endpoint, params: { title: 'TestPage', body: "a\nb\nc", message: 'init' },
|
||||
post endpoint, params: { title: 'Help:TestPage', body: "a\nb\nc", message: 'init' },
|
||||
headers: auth_headers(member)
|
||||
end
|
||||
.to change(WikiPage, :count).by(1)
|
||||
@@ -121,7 +121,7 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
expect(response).to have_http_status(:created)
|
||||
|
||||
page_id = json.fetch('id')
|
||||
expect(json.fetch('title')).to eq('TestPage')
|
||||
expect(json.fetch('title')).to eq('Help:TestPage')
|
||||
|
||||
created_page = WikiPage.find(page_id)
|
||||
version = created_page.wiki_versions.order(:version_no).last
|
||||
@@ -129,7 +129,7 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
expect(version).to have_attributes(
|
||||
version_no: 1,
|
||||
event_type: 'create',
|
||||
title: 'TestPage',
|
||||
title: 'Help:TestPage',
|
||||
body: "a\nb\nc",
|
||||
created_by_user_id: member.id
|
||||
)
|
||||
@@ -151,7 +151,7 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
WikiLine.create!(sha256: Digest::SHA256.hexdigest('a'), body: 'a', created_at: Time.current, updated_at: Time.current)
|
||||
|
||||
post endpoint,
|
||||
params: { title: 'Reuse', body: "a\na" },
|
||||
params: { title: 'Help:Reuse', body: "a\na" },
|
||||
headers: auth_headers(member)
|
||||
|
||||
page = WikiPage.find(JSON.parse(response.body).fetch('id'))
|
||||
@@ -166,7 +166,7 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
duplicated = 'duplicated_line_for_wiki_line_upsert_spec'
|
||||
|
||||
post endpoint,
|
||||
params: { title: 'DuplicateNewLine', body: "#{ duplicated }\n#{ duplicated }" },
|
||||
params: { title: 'Help:DuplicateNewLine', body: "#{ duplicated }\n#{ duplicated }" },
|
||||
headers: auth_headers(member)
|
||||
|
||||
expect(response).to have_http_status(:created)
|
||||
@@ -182,7 +182,8 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
|
||||
it 'normalises CRLF and strips trailing newlines' do
|
||||
post endpoint,
|
||||
params: { title: 'NormalisedBody', body: "a\r\nb\r\n\r\n", message: 'normalise' },
|
||||
params: { title: 'Help:NormalisedBody',
|
||||
body: "a\r\nb\r\n\r\n", message: 'normalise' },
|
||||
headers: auth_headers(member)
|
||||
|
||||
expect(response).to have_http_status(:created)
|
||||
@@ -413,10 +414,10 @@ RSpec.describe 'Wiki API', type: :request do
|
||||
top = json.first
|
||||
expect(top).to include(
|
||||
'revision_id' => rev2.id,
|
||||
'pred' => rev2.base_revision_id,
|
||||
'pred' => rev1.id,
|
||||
'succ' => nil,
|
||||
'kind' => 'content',
|
||||
'message' => 'r2'
|
||||
'message' => nil
|
||||
)
|
||||
expect(top['wiki_page']).to include(
|
||||
'id' => page.id,
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする