このコミットが含まれているのは:
2026-10-12 21:53:02 +09:00
コミット 7cf2978f5f
2個のファイルの変更、16行の追加、3行の削除
+5 -1
ファイルの表示
@@ -27,8 +27,12 @@ RSpec.describe 'Shared Tag and ExternalTag IDs', type: :model do
end end
it "uses the current maximum after deleting earlier #{ resource } records" do it "uses the current maximum after deleting earlier #{ resource } records" do
create(:tag, id: 100).destroy! tag = create(:tag, id: 100)
TagName.where(tag_id: tag.id).update_all(tag_id: nil)
tag.destroy!
create(:external_tag, id: 200).destroy! create(:external_tag, id: 200).destroy!
expect(Tag.unscoped.count).to eq(0)
expect(ExternalTag.unscoped.count).to eq(0)
expect(create_resource(resource).id).to eq(1) expect(create_resource(resource).id).to eq(1)
end end
+11 -2
ファイルの表示
@@ -206,7 +206,13 @@ RSpec.describe 'Tag description native API', type: :request do
context 'without an existing description' do context 'without an existing description' do
before { tag } before { tag }
it 'creates both current resources and histories with matching compatibility IDs' do it 'creates a description with synchronised Wiki content and histories' do
unrelated = Wiki::Commit.create_legacy_content!(
tag_name: create(:tag_name, name: 'Help:unrelated_native_description'),
body: 'unrelated body', created_by_user: author)
unrelated_state = [unrelated.attributes,
unrelated.wiki_revisions.map(&:attributes),
unrelated.wiki_versions.map(&:attributes)]
expect { native_write(body: 'created natively') } expect { native_write(body: 'created natively') }
.to change(TagDescription, :count).by(1) .to change(TagDescription, :count).by(1)
.and change(TagDescriptionVersion, :count).by(1) .and change(TagDescriptionVersion, :count).by(1)
@@ -215,7 +221,7 @@ RSpec.describe 'Tag description native API', type: :request do
.and change(WikiVersion, :count).by(1) .and change(WikiVersion, :count).by(1)
expect(response).to have_http_status(:created) expect(response).to have_http_status(:created)
description = TagDescription.find_by!(tag_id: tag.id, language_code: 'ja') description = TagDescription.find_by!(tag_id: tag.id, language_code: 'ja')
page = WikiPage.find(description.id) page = WikiPage.find_by!(tag_name: tag.tag_name('ja'))
revision = page.current_revision revision = page.current_revision
version = TagDescriptionVersion.find(revision.id) version = TagDescriptionVersion.find(revision.id)
expect(description).to have_attributes( expect(description).to have_attributes(
@@ -227,6 +233,9 @@ RSpec.describe 'Tag description native API', type: :request do
expect(page).to have_attributes(tag_name_id: tag_name.id, body: description.body) expect(page).to have_attributes(tag_name_id: tag_name.id, body: description.body)
expect(revision.body).to eq(version.body) expect(revision.body).to eq(version.body)
expect(page.wiki_versions.last.body).to eq(version.body) expect(page.wiki_versions.last.body).to eq(version.body)
unrelated.reload
expect([unrelated.attributes, unrelated.wiki_revisions.map(&:attributes),
unrelated.wiki_versions.map(&:attributes)]).to eq(unrelated_state)
expect_current(description) expect_current(description)
get "/wiki/#{ description.id }" get "/wiki/#{ description.id }"