このコミットが含まれているのは:
@@ -64,7 +64,8 @@ RSpec.describe 'nico:sync' do
|
||||
run_rake_task('nico:sync')
|
||||
|
||||
post.reload
|
||||
active_tag_names = post.tags.joins(:tag_name).pluck('tag_names.name')
|
||||
active_tag_names = TagName.where(tag_id: post.tags.select(:id),
|
||||
language_code: 'ja', primary_flg: true).pluck(:name)
|
||||
|
||||
expect(active_tag_names).to include('spec_kept')
|
||||
expect(post.external_tags).to contain_exactly(nico)
|
||||
@@ -434,7 +435,9 @@ RSpec.describe 'nico:sync' do
|
||||
|
||||
external = post.external_tags.sole
|
||||
expect(external.name).to eq('raw tag[]')
|
||||
expect(post.tags.map(&:name)).not_to include('bot操作')
|
||||
expect(TagName.where(tag_id: post.tags.select(:id),
|
||||
language_code: 'ja', primary_flg: true).pluck(:name))
|
||||
.not_to include('bot操作')
|
||||
expect(post.post_versions.order(:version_no).last.tags_json)
|
||||
.to include('external_tag_id' => external.id)
|
||||
|
||||
@@ -446,7 +449,9 @@ RSpec.describe 'nico:sync' do
|
||||
run_nico_sync_with_tags!([])
|
||||
}.to change(PostVersion, :count).by(1)
|
||||
expect(post.reload.external_tags).to be_empty
|
||||
expect(post.tags.map(&:name)).not_to include('bot操作')
|
||||
expect(TagName.where(tag_id: post.tags.select(:id),
|
||||
language_code: 'ja', primary_flg: true).pluck(:name))
|
||||
.not_to include('bot操作')
|
||||
end
|
||||
|
||||
it 'サニタイズ後の既存外部タグを再利用し、その連携タグを記載する' do
|
||||
@@ -563,7 +568,9 @@ RSpec.describe 'nico:sync' do
|
||||
name: 'AAA')
|
||||
expect(ExternalTag.exists?(platform: :nico, name: 'AAA?')).to be(false)
|
||||
|
||||
expect(post.tags.map(&:name)).not_to include('bot操作')
|
||||
expect(TagName.where(tag_id: post.tags.select(:id),
|
||||
language_code: 'ja', primary_flg: true).pluck(:name))
|
||||
.not_to include('bot操作')
|
||||
expect(post.post_versions.order(:version_no).last.tags_json)
|
||||
.to include('external_tag_id' => external.id)
|
||||
|
||||
@@ -577,7 +584,9 @@ RSpec.describe 'nico:sync' do
|
||||
}.to change(PostVersion, :count).by(1)
|
||||
|
||||
expect(post.reload.external_tags).to be_empty
|
||||
expect(post.tags.map(&:name)).not_to include('bot操作')
|
||||
expect(TagName.where(tag_id: post.tags.select(:id),
|
||||
language_code: 'ja', primary_flg: true).pluck(:name))
|
||||
.not_to include('bot操作')
|
||||
end
|
||||
|
||||
it 'nico: prefix を含む従来の規則で外部タグ名をサニタイズする' do
|
||||
|
||||
@@ -6,10 +6,10 @@ RSpec.describe 'post_similarity:calc' do
|
||||
|
||||
it 'calculates similarities from active tags only' do
|
||||
# 必要最低限のデータ
|
||||
t1 = create(:tag, name: 't1')
|
||||
t2 = create(:tag, name: 't2')
|
||||
t3 = create(:tag, name: 't3')
|
||||
deprecated_tag = create(:tag, name: 'deprecated', deprecated_at: Time.current)
|
||||
t1 = create(:tag, primary_name: 't1')
|
||||
t2 = create(:tag, primary_name: 't2')
|
||||
t3 = create(:tag, primary_name: 't3')
|
||||
deprecated_tag = create(:tag, primary_name: 'deprecated', deprecated_at: Time.current)
|
||||
|
||||
p1 = Post.create!(url: "https://example.com/1")
|
||||
p2 = Post.create!(url: "https://example.com/2")
|
||||
|
||||
@@ -6,10 +6,10 @@ RSpec.describe 'tag_similarity:calc' do
|
||||
|
||||
it 'calculates similarities for active tags only' do
|
||||
# 必要最低限のデータ
|
||||
t1 = create(:tag, name: 't1')
|
||||
t2 = create(:tag, name: 't2')
|
||||
t3 = create(:tag, name: 't3')
|
||||
deprecated_tag = create(:tag, name: 'deprecated', deprecated_at: Time.current)
|
||||
t1 = create(:tag, primary_name: 't1')
|
||||
t2 = create(:tag, primary_name: 't2')
|
||||
t3 = create(:tag, primary_name: 't3')
|
||||
deprecated_tag = create(:tag, primary_name: 'deprecated', deprecated_at: Time.current)
|
||||
|
||||
p1 = Post.create!(url: "https://example.com/1")
|
||||
p2 = Post.create!(url: "https://example.com/2")
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする