gimei 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +6 -2
- data/README.md +54 -4
- data/gimei.gemspec +3 -2
- data/lib/data/addresses.yml +3080 -0
- data/lib/gimei.rb +22 -123
- data/lib/gimei/address.rb +83 -0
- data/lib/gimei/name.rb +103 -0
- data/lib/gimei/version.rb +1 -1
- data/spec/address_spec.rb +46 -0
- data/spec/gimei_spec.rb +154 -0
- data/spec/name_spec.rb +65 -34
- data/spec/spec_helper.rb +5 -2
- metadata +38 -15
data/spec/name_spec.rb
CHANGED
@@ -1,100 +1,132 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require_relative 'spec_helper'
|
3
3
|
|
4
|
-
describe Gimei do
|
4
|
+
describe Gimei::Name do
|
5
5
|
describe '.male' do
|
6
|
-
before { @name = Gimei.male }
|
6
|
+
before { @name = Gimei::Name.male }
|
7
7
|
|
8
|
-
it '
|
8
|
+
it 'Gimei::Name オブジェクトが返ること' do
|
9
|
+
@name.must_be_instance_of Gimei::Name
|
10
|
+
end
|
11
|
+
|
12
|
+
it '#male? が true を返すこと' do
|
9
13
|
@name.male?.must_equal true
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|
13
17
|
describe '.female' do
|
14
|
-
before { @name = Gimei.female }
|
18
|
+
before { @name = Gimei::Name.female }
|
15
19
|
|
16
|
-
it '
|
20
|
+
it 'Gimei::Name オブジェクトが返ること' do
|
21
|
+
@name.must_be_instance_of Gimei::Name
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#female? が true を返すこと' do
|
17
25
|
@name.female?.must_equal true
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
21
|
-
describe '
|
22
|
-
|
29
|
+
describe '.kanji' do
|
30
|
+
it '全角文字とスペースが返ること' do
|
31
|
+
Gimei::Name.kanji.must_match /\A[#{Moji.zen}\s]+\z/
|
32
|
+
end
|
33
|
+
end
|
23
34
|
|
35
|
+
describe '.hiragana' do
|
36
|
+
it 'ひらがなとスペースが返ること' do
|
37
|
+
Gimei::Name.hiragana.must_match /\A[\p{hiragana}\s]+\z/
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '.katakana' do
|
42
|
+
it 'カタカナとスペースが返ること' do
|
43
|
+
Gimei::Name.katakana.must_match /\A[\p{katakana}\s]+\z/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#kanji' do
|
24
48
|
it '全角文字とスペースが返ること' do
|
25
|
-
|
49
|
+
Gimei::Name.new.kanji.must_match /\A[#{Moji.zen}\s]+\z/
|
26
50
|
end
|
27
51
|
end
|
28
52
|
|
29
53
|
describe '#hiragana' do
|
30
|
-
before { @name = Gimei.new }
|
31
|
-
|
32
54
|
it 'ひらがなとスペースが返ること' do
|
33
|
-
|
55
|
+
Gimei::Name.new.hiragana.must_match /\A[\p{hiragana}\s]+\z/
|
34
56
|
end
|
35
57
|
end
|
36
58
|
|
37
59
|
describe '#katakana' do
|
38
|
-
before { @name = Gimei.new }
|
39
|
-
|
40
60
|
it 'カタカナとスペースが返ること' do
|
41
|
-
|
61
|
+
Gimei::Name.new.katakana.must_match /\A[\p{katakana}\s]+\z/
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#first' do
|
66
|
+
it 'Gimei::Name::First オブジェクトが返ること' do
|
67
|
+
Gimei::Name.new.first.must_be_instance_of Gimei::Name::First
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#last' do
|
72
|
+
it 'Gimei::Name::Last オブジェクトが返ること' do
|
73
|
+
Gimei::Name.new.last.must_be_instance_of Gimei::Name::Last
|
42
74
|
end
|
43
75
|
end
|
44
76
|
end
|
45
77
|
|
46
|
-
describe Gimei::First do
|
78
|
+
describe Gimei::Name::First do
|
47
79
|
describe '.male' do
|
48
|
-
before { @name = Gimei::First.male }
|
80
|
+
before { @name = Gimei::Name::First.male }
|
81
|
+
|
82
|
+
it 'Gimei::Name::First オブジェクトが返ること' do
|
83
|
+
@name.must_be_instance_of Gimei::Name::First
|
84
|
+
end
|
49
85
|
|
50
|
-
it '
|
86
|
+
it '#male? が true を返すこと' do
|
51
87
|
@name.male?.must_equal true
|
52
88
|
end
|
53
89
|
end
|
54
90
|
|
55
91
|
describe '.female' do
|
56
|
-
before { @name = Gimei::First.female }
|
92
|
+
before { @name = Gimei::Name::First.female }
|
93
|
+
|
94
|
+
it 'Gimei::Name::First オブジェクトが返ること' do
|
95
|
+
@name.must_be_instance_of Gimei::Name::First
|
96
|
+
end
|
57
97
|
|
58
|
-
it '
|
98
|
+
it '#female? が true を返すこと' do
|
59
99
|
@name.female?.must_equal true
|
60
100
|
end
|
61
101
|
end
|
62
102
|
|
63
103
|
describe '#kanji' do
|
64
|
-
before { @name = Gimei::First.new }
|
65
|
-
|
66
104
|
it '全角文字が返ること' do
|
67
|
-
|
105
|
+
Gimei::Name::First.new.kanji.must_match /\A#{Moji.zen}+\z/
|
68
106
|
end
|
69
107
|
end
|
70
108
|
|
71
109
|
describe '#hiragana' do
|
72
|
-
before { @name = Gimei::First.new }
|
73
|
-
|
74
110
|
it 'ひらがなが返ること' do
|
75
|
-
|
111
|
+
Gimei::Name::First.new.hiragana.must_match /\A\p{hiragana}+\z/
|
76
112
|
end
|
77
113
|
end
|
78
114
|
|
79
115
|
describe '#katakana' do
|
80
|
-
before { @name = Gimei::First.new }
|
81
|
-
|
82
116
|
it 'カタカナが返ること' do
|
83
|
-
|
117
|
+
Gimei::Name::First.new.katakana.must_match /\A\p{katakana}+\z/
|
84
118
|
end
|
85
119
|
end
|
86
120
|
|
87
121
|
describe '#to_s' do
|
88
|
-
before { @name = Gimei::First.new }
|
89
|
-
|
90
122
|
it '全角文字が返ること' do
|
91
|
-
|
123
|
+
Gimei::Name::First.new.to_s.must_match /\A#{Moji.zen}+\z/
|
92
124
|
end
|
93
125
|
end
|
94
126
|
end
|
95
127
|
|
96
|
-
describe Gimei::Last do
|
97
|
-
before { @name = Gimei::Last.new }
|
128
|
+
describe Gimei::Name::Last do
|
129
|
+
before { @name = Gimei::Name::Last.new }
|
98
130
|
|
99
131
|
describe '#kanji' do
|
100
132
|
it '全角文字が返ること' do
|
@@ -120,4 +152,3 @@ describe Gimei::Last do
|
|
120
152
|
end
|
121
153
|
end
|
122
154
|
end
|
123
|
-
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
lib = File.expand_path('../../lib', __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
|
-
require 'gimei'
|
5
|
-
|
6
4
|
require 'bundler/setup'
|
5
|
+
|
6
|
+
require 'coveralls'
|
7
|
+
Coveralls.wear!
|
8
|
+
|
9
|
+
require 'gimei'
|
7
10
|
require 'minitest/autorun'
|
8
11
|
require 'moji'
|
metadata
CHANGED
@@ -1,75 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: moji
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: random Japanese name and address generator
|
56
70
|
email:
|
57
71
|
- netwillnet@gmail.com
|
58
72
|
executables: []
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
- .
|
63
|
-
- .
|
76
|
+
- ".coveralls.yml"
|
77
|
+
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
64
79
|
- CHANGELOG.md
|
65
80
|
- Gemfile
|
66
81
|
- LICENSE.txt
|
67
82
|
- README.md
|
68
83
|
- Rakefile
|
69
84
|
- gimei.gemspec
|
85
|
+
- lib/data/addresses.yml
|
70
86
|
- lib/data/names.yml
|
71
87
|
- lib/gimei.rb
|
88
|
+
- lib/gimei/address.rb
|
89
|
+
- lib/gimei/name.rb
|
72
90
|
- lib/gimei/version.rb
|
91
|
+
- spec/address_spec.rb
|
92
|
+
- spec/gimei_spec.rb
|
73
93
|
- spec/name_spec.rb
|
74
94
|
- spec/spec_helper.rb
|
75
95
|
homepage: https://github.com/willnet/gimei
|
@@ -82,20 +102,23 @@ require_paths:
|
|
82
102
|
- lib
|
83
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
104
|
requirements:
|
85
|
-
- -
|
105
|
+
- - ">="
|
86
106
|
- !ruby/object:Gem::Version
|
87
107
|
version: '0'
|
88
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
109
|
requirements:
|
90
|
-
- -
|
110
|
+
- - ">="
|
91
111
|
- !ruby/object:Gem::Version
|
92
112
|
version: '0'
|
93
113
|
requirements: []
|
94
114
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.2.2
|
96
116
|
signing_key:
|
97
117
|
specification_version: 4
|
98
|
-
summary: random Japanese name generator. support kanji, hiragana, and
|
118
|
+
summary: random Japanese name and address generator. support kanji, hiragana, and
|
119
|
+
katakana
|
99
120
|
test_files:
|
121
|
+
- spec/address_spec.rb
|
122
|
+
- spec/gimei_spec.rb
|
100
123
|
- spec/name_spec.rb
|
101
124
|
- spec/spec_helper.rb
|