このコミットが含まれているのは:
@@ -114,4 +114,26 @@ RSpec.describe 'Tag group Markdown round trips through the Wiki facade', type: :
|
||||
- 洗澡鹿
|
||||
MARKDOWN
|
||||
end
|
||||
|
||||
it 'rejects mixed top-level heading Sections and Tags without losing structure' do
|
||||
id = seed_group(
|
||||
name: '混在構造', members: [tag_member(series)],
|
||||
placements: [
|
||||
{ 'section_name' => '区分', 'description' => nil, 'children' => [] },
|
||||
tag_node(series)])
|
||||
|
||||
get group_title_path('混在構造')
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(group_rows('tag_groups', id:).sole.fetch('id')).to eq(id)
|
||||
end
|
||||
|
||||
it 'rejects membership without a placement instead of omitting it' do
|
||||
id = seed_group(name: '未配置構造', members: [tag_member(series)])
|
||||
|
||||
get group_title_path('未配置構造')
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(group_rows('tag_groups', id:).sole.fetch('id')).to eq(id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,6 +79,82 @@ RSpec.describe 'Tag group Wiki facade reads', type: :request do
|
||||
'タググループ:読取り契約', help.title, '新タグ')
|
||||
end
|
||||
|
||||
it 'keeps Help readable when its ID collides with a new group' do
|
||||
help = Wiki::Commit.create_legacy_content!(
|
||||
tag_name: create(:tag_name, name: 'Help:ID重複'), body: 'help body',
|
||||
created_by_user: user)
|
||||
seed_group(name: '別 ID重複', id: help.id, description: 'group body')
|
||||
|
||||
get '/wiki'
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.map { _1.fetch('title') }).to include(help.title, 'タググループ:別 ID重複')
|
||||
|
||||
get "/wiki/title/#{ CGI.escapeURIComponent(help.title) }"
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.fetch('body')).to eq('help body')
|
||||
|
||||
get '/wiki/changes'
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.map { _1.dig('wiki_page', 'title') }).to include(
|
||||
help.title, 'タググループ:別 ID重複')
|
||||
end
|
||||
|
||||
it 'finds groups by a partial prefix of their displayed title' do
|
||||
get '/wiki', params: { title: 'タググル' }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.map { _1.fetch('title') }).to include('タググループ:読取り契約')
|
||||
expect(json.find { _1.fetch('title') == 'タググループ:読取り契約' })
|
||||
.to include('updated_at' => be_present)
|
||||
end
|
||||
|
||||
it 'does not restore a stale namespaced Wiki page after a group rename' do
|
||||
old_page = legacy_group('旧名称', '- 旧本文')
|
||||
seed_group(name: '新名称', id: old_page.id, description: '正本')
|
||||
|
||||
get group_title_path('旧名称')
|
||||
expect(response).to have_http_status(:not_found)
|
||||
get "#{ group_title_path('旧名称') }/exists"
|
||||
expect(response).to have_http_status(:not_found)
|
||||
get group_title_path('新名称')
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.fetch('body').strip).to eq('正本')
|
||||
end
|
||||
|
||||
it 'orders mixed resource history by timestamp rather than independent IDs' do
|
||||
help = Wiki::Commit.create_legacy_content!(
|
||||
tag_name: create(:tag_name, name: 'Help:時系列'), body: 'help',
|
||||
created_by_user: user)
|
||||
TagDescriptionOperation.create!(tag: new_tag, body: 'description', created_by_user: user)
|
||||
TagGroupVersion.update_all(created_at: 3.days.ago)
|
||||
WikiRevision.where(wiki_page_id: help.id).update_all(created_at: 2.days.ago)
|
||||
TagDescriptionVersion.update_all(created_at: 1.day.ago)
|
||||
|
||||
get '/wiki/changes'
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
timestamps = json.map { Time.iso8601(_1.fetch('timestamp')) }
|
||||
expect(timestamps).to eq(timestamps.sort.reverse)
|
||||
titles = json.map { _1.dig('wiki_page', 'title') }
|
||||
expect(titles.index('新タグ')).to be < titles.index(help.title)
|
||||
expect(titles.index(help.title)).to be < titles.index('タググループ:読取り契約')
|
||||
end
|
||||
|
||||
it 'renders nullable group editors without raising' do
|
||||
group_connection.execute(
|
||||
"UPDATE tag_groups SET created_by_user_id = NULL, updated_by_user_id = NULL " +
|
||||
"WHERE id = #{ page.id }")
|
||||
group_connection.execute(
|
||||
"UPDATE tag_group_versions SET created_by_user_id = NULL " +
|
||||
"WHERE tag_group_id = #{ page.id }")
|
||||
|
||||
get "/tag_groups/#{ page.id }"
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json).to include('created_by_user' => nil, 'updated_by_user' => nil)
|
||||
get "/wiki/title/#{ CGI.escapeURIComponent('タググループ:読取り契約') }"
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'reads group version IDs, editor and timestamps in scoped changes' do
|
||||
without_group_legacy_reads { get '/wiki/changes', params: { id: page.id } }
|
||||
expect(response).to have_http_status(:ok)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする