ニコニコ同期でオリジナルの投稿日時連携(#246) (#248)

#246

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #248
This commit was merged in pull request #248.
This commit is contained in:
2026-01-31 03:07:19 +09:00
parent 39ec57c142
commit 5a02be0517
2 changed files with 19 additions and 5 deletions
+9 -2
View File
@@ -13,7 +13,6 @@ RSpec.describe "nico:sync" do
end
def link_nico_to_tag!(nico_tag, tag)
# NicoTagRelation がある前提(君の model からそう見える)
NicoTagRelation.create!(nico_tag_id: nico_tag.id, tag_id: tag.id)
end
@@ -35,7 +34,12 @@ RSpec.describe "nico:sync" do
Tag.tagme
# pythonの出力(AAA が付く)
stub_python([{ "code" => "sm9", "title" => "t", "tags" => ["AAA"] }])
stub_python([{
'code' => 'sm9',
'title' => 't',
'tags' => ['AAA'],
'uploaded_at' => '2026-01-01T12:34:56+09:00',
'deleted_at' => '2026-01-31T00:00:00+09:00' }])
# 外部HTTPは今回「既存 post なので呼ばれない」はずだが、念のため塞ぐ
allow(URI).to receive(:open).and_return(StringIO.new("<html></html>"))
@@ -49,6 +53,9 @@ RSpec.describe "nico:sync" do
expect(active_tag_names).to include("nico:AAA")
expect(active_tag_names).to include("spec_linked")
expect(post.original_created_from).to eq(Time.iso8601('2026-01-01T03:34:00Z'))
expect(post.original_created_before).to eq(Time.iso8601('2026-01-01T03:35:00Z'))
# 差分が出るので bot が付く(kept_non_nico_ids != desired_non_nico_ids
expect(active_tag_names).to include("bot操作")
end