human_name_parser 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/human_name_parser/name.rb +1 -1
- data/lib/human_name_parser/version.rb +1 -1
- data/spec/name_spec.rb +26 -21
- metadata +3 -3
data/spec/name_spec.rb
CHANGED
@@ -23,6 +23,28 @@ describe HumanNameParser::Name do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
context "when full name is Marley Mante" do
|
27
|
+
let(:full_name) { "Marley Mante" }
|
28
|
+
it "should parse the name" do
|
29
|
+
@name = HumanNameParser::Name.new full_name
|
30
|
+
@name.first.should == 'Marley'
|
31
|
+
@name.last.should == 'Mante'
|
32
|
+
@name.middle.should == ''
|
33
|
+
@name.suffix.should == ''
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when full name is Marley" do
|
38
|
+
let(:full_name) { "Marley" }
|
39
|
+
it "should parse the name" do
|
40
|
+
@name = HumanNameParser::Name.new full_name
|
41
|
+
@name.first.should == 'Marley'
|
42
|
+
@name.last.should == ''
|
43
|
+
@name.middle.should == ''
|
44
|
+
@name.suffix.should == ''
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
26
48
|
context 'when full name is Mary Lou Smith' do
|
27
49
|
let(:full_name) { "Mary Lou Smith" }
|
28
50
|
before do
|
@@ -37,6 +59,10 @@ describe HumanNameParser::Name do
|
|
37
59
|
@name.last.should == 'Smith'
|
38
60
|
end
|
39
61
|
|
62
|
+
it "gets middle" do
|
63
|
+
@name.middle.should == 'Lou'
|
64
|
+
end
|
65
|
+
|
40
66
|
it "gets prefix" do
|
41
67
|
@name.prefix.should == ''
|
42
68
|
end
|
@@ -92,27 +118,6 @@ describe HumanNameParser::Name do
|
|
92
118
|
end
|
93
119
|
end
|
94
120
|
|
95
|
-
context 'when full name is John Paul Ringo' do
|
96
|
-
let(:full_name) { "John Paul Ringo" }
|
97
|
-
before { @name = HumanNameParser::Name.new full_name }
|
98
|
-
|
99
|
-
it "gets first" do
|
100
|
-
@name.first.should == 'John'
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'gets initials' do
|
104
|
-
@name.initials.should == 'JPR'
|
105
|
-
end
|
106
|
-
|
107
|
-
it "gets last" do
|
108
|
-
@name.last.should == 'Ringo'
|
109
|
-
end
|
110
|
-
|
111
|
-
it "gets middle" do
|
112
|
-
@name.middle.should == 'Paul'
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
121
|
context 'when full name is Downey Jr., Robert' do
|
117
122
|
let(:full_name) { 'Downey Jr., Robert' }
|
118
123
|
before { @name = HumanNameParser::Name.new full_name }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: human_name_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Bachman
|