Sha256: 08cd09b1e452a3d27463b7a936994f932af8ad7bbd641db74dfca284d2671d9d
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe Cnname::Name do subject { Cnname::Name.new(name) } context 'when given a single surname' do context 'and the first name only has one word' do let(:name) { '张三' } its(:first_name) { should == '三' } its(:last_name) { should == '张' } end context 'and the first name has more than one word' do let(:name) { '张三丰' } its(:first_name) { should == '三丰' } its(:last_name) { should == '张' } end end context 'when given a compound surname' do context 'and the first name only has one word' do let(:name) { '诸葛亮' } its(:first_name) { should == '亮' } its(:last_name) { should == '诸葛' } end context 'and the first name has more than one word' do let(:name) { '西门吹雪' } its(:first_name) { should == '吹雪' } its(:last_name) { should == '西门' } end end context 'when given an invalid surname' do it 'raises an error' do expect { Cnname::Name.new('不存在') }.to raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cnname-0.1.0 | spec/cnname/name_spec.rb |