このコミットが含まれているのは:
@@ -0,0 +1,20 @@
|
||||
require 'rails_helper'
|
||||
|
||||
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)
|
||||
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.create!(code: 'Zzzz', name: 'Unsupported')
|
||||
}.to raise_error { |error|
|
||||
expect(error).to be_a(ArgumentError).or be_a(ActiveRecord::RecordInvalid)
|
||||
}
|
||||
end
|
||||
end
|
||||
新しいイシューから参照
ユーザーをブロックする