このコミットが含まれているのは:
@@ -22,7 +22,7 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
let(:locale_params) { requested_locale ? { locale: requested_locale } : { } }
|
||||
let(:expected_locale) { requested_locale ? locale : Locale.nipponese }
|
||||
|
||||
it 'creates post tags in the requested language or Japanese fallback' do
|
||||
it 'creates post tags in the requested language or Nipponese fallback' do
|
||||
post '/posts', params: locale_params.merge(
|
||||
title: 'Locale post', url: 'https://example.com/locale-post',
|
||||
tags: 'locale_post_tag', parent_post_ids: '')
|
||||
@@ -32,7 +32,7 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
expect(Post.find(json.fetch('id')).tags).to include(tag)
|
||||
end
|
||||
|
||||
it 'updates post tags in the requested language or Japanese fallback' do
|
||||
it 'updates post tags in the requested language or Nipponese fallback' do
|
||||
record = create(:post)
|
||||
PostVersionRecorder.record!(post: record, event_type: :create, created_by_user: member)
|
||||
|
||||
@@ -110,8 +110,8 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
create(:tag_name, name: 'shared_name', language_code: 'en', script_code: 'Latn')
|
||||
end
|
||||
let!(:english_tag) { create(:tag, primary_tag_name: english_name, category: :material) }
|
||||
let!(:japanese_tag) do
|
||||
create(:tag, primary_name: 'temporary_japanese', category: :general).tap do |tag|
|
||||
let!(:nipponese_tag) do
|
||||
create(:tag, primary_name: 'temporary_nipponese', category: :general).tap do |tag|
|
||||
# Isolate lookup from the separately tested uniqueness validation.
|
||||
primary_tag_name_for(tag, 'ja').update_columns(name: 'shared_name')
|
||||
end
|
||||
@@ -125,9 +125,9 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
expect(response).to have_http_status(:created), response.body
|
||||
record = Post.find(json.fetch('id'))
|
||||
expect(record.tags).to include(english_tag)
|
||||
expect(record.tags).not_to include(japanese_tag)
|
||||
expect(record.tags).not_to include(nipponese_tag)
|
||||
expect(english_tag.reload.category).to eq('material')
|
||||
expect(japanese_tag.reload.category).to eq('general')
|
||||
expect(nipponese_tag.reload.category).to eq('general')
|
||||
end
|
||||
|
||||
it 'updates the post using the English identity' do
|
||||
@@ -140,7 +140,7 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
|
||||
expect(response).to have_http_status(:ok), response.body
|
||||
expect(record.reload.tags).to include(english_tag)
|
||||
expect(record.tags).not_to include(japanese_tag)
|
||||
expect(record.tags).not_to include(nipponese_tag)
|
||||
end
|
||||
|
||||
it 'resolves the English material tag' do
|
||||
@@ -149,7 +149,7 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
|
||||
expect(response).to have_http_status(:created), response.body
|
||||
expect(Material.find(json.fetch('id')).tag).to eq(english_tag)
|
||||
expect(Material.where(tag: japanese_tag)).to be_empty
|
||||
expect(Material.where(tag: nipponese_tag)).to be_empty
|
||||
end
|
||||
|
||||
it 'resolves the English parent tag' do
|
||||
@@ -182,16 +182,16 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
end
|
||||
let!(:tag) { create(:tag, primary_tag_name: english_name) }
|
||||
|
||||
it 'allows a rename to a name already used in Japanese' do
|
||||
japanese = create(:tag, primary_name: 'rename_target')
|
||||
it 'allows a rename to a name already used in Nipponese' do
|
||||
nipponese = create(:tag, primary_name: 'rename_target')
|
||||
|
||||
patch "/tags/#{ tag.id }", params: { locale: 'en', name: 'rename_target' }
|
||||
|
||||
expect(response).to have_http_status(:ok), response.body
|
||||
expect(primary_tag_name_for(tag.reload, 'en')).to have_attributes(
|
||||
name: 'rename_target', language_code: 'en', tag_id: tag.id)
|
||||
expect(primary_tag_name_for(japanese.reload, 'ja')).to have_attributes(
|
||||
name: 'rename_target', language_code: 'ja', tag_id: japanese.id)
|
||||
expect(primary_tag_name_for(nipponese.reload, 'ja')).to have_attributes(
|
||||
name: 'rename_target', language_code: 'ja', tag_id: nipponese.id)
|
||||
end
|
||||
|
||||
it 'creates aliases in the requested language' do
|
||||
@@ -210,11 +210,11 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
end
|
||||
|
||||
it 'does not take an alias from another language' do
|
||||
japanese = create(:tag, primary_name: 'japanese_owner')
|
||||
japanese_alias = create(:tag_name, :alias, name: 'shared_alias',
|
||||
tag: japanese)
|
||||
expect(japanese_alias.reload).to have_attributes(
|
||||
tag_id: japanese.id,
|
||||
nipponese = create(:tag, primary_name: 'nipponese_owner')
|
||||
nipponese_alias = create(:tag_name, :alias, name: 'shared_alias',
|
||||
tag: nipponese)
|
||||
expect(nipponese_alias.reload).to have_attributes(
|
||||
tag_id: nipponese.id,
|
||||
primary_flg: false, language_code: 'ja')
|
||||
|
||||
put "/tags/#{ tag.id }", params: {
|
||||
@@ -223,15 +223,15 @@ RSpec.describe 'Locale propagation on write paths', type: :request do
|
||||
aliases: 'shared_alias', parent_tags: '' }
|
||||
|
||||
expect(response).to have_http_status(:ok), response.body
|
||||
expect(japanese_alias.reload).to have_attributes(
|
||||
tag_id: japanese.id,
|
||||
expect(nipponese_alias.reload).to have_attributes(
|
||||
tag_id: nipponese.id,
|
||||
primary_flg: false, language_code: 'ja')
|
||||
expect(TagName.find_by!(language_code: 'en', name: 'shared_alias'))
|
||||
.to have_attributes(
|
||||
tag_id: tag.id, script_code: 'Latn',
|
||||
primary_flg: false, language_code: 'en')
|
||||
expect(TagName.where(name: 'shared_alias').pluck(:language_code, :tag_id))
|
||||
.to contain_exactly(['ja', japanese.id], ['en', tag.id])
|
||||
.to contain_exactly(['ja', nipponese.id], ['en', tag.id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする