このコミットが含まれているのは:
2026-10-01 23:21:03 +09:00
コミット 860cd82175
17個のファイルの変更、485行の追加、79行の削除
+19 -4
ファイルの表示
@@ -4,17 +4,32 @@ RSpec.describe Script, type: :model do
include_context 'English locale'
it 'selects locales by script code, not language code' do
expect(described_class.find('Latn').locales).to include(locale)
expect(described_class.find('Jpan').locales).to include(Locale.nipponese)
expect(described_class.find('Jpan').locales).not_to include(locale)
expect(described_class.find('Jpan').locales).to contain_exactly(Locale.nipponese)
end
it 'accepts supported script codes and rejects unsupported ones' do
expect(described_class.new(code: 'Latn', name: 'Latin')).to be_valid
expect(described_class.find('Jpan')).to be_valid
expect(described_class.where(deprecated_at: nil).pluck(:code)).to eq(['Jpan'])
expect {
described_class.create!(code: 'Zzzz', name: 'Unsupported')
}.to raise_error { |error|
expect(error).to be_a(ArgumentError).or be_a(ActiveRecord::RecordInvalid)
}
end
it 'does not register Latin as a currently supported script' do
expect {
described_class.create!(code: 'Latn', name: 'Latin')
}.to raise_error { |error|
expect(error).to be_a(ArgumentError).or be_a(ActiveRecord::RecordInvalid)
}
end
it 'selects Latin locales when multilingual support is enabled' do
pending '日本語以外の Locale 有効化は別課題で実装する'
locale
expect(described_class.find('Latn').locales).to contain_exactly(locale)
expect(described_class.find('Jpan').locales).not_to include(locale)
end
end