forgery_ja 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.yardoc/checksums +2 -1
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile +1 -0
- data/README.markdown +78 -34
- data/lib/emoji/docomo.rb +297 -0
- data/lib/emoji/google.rb +817 -0
- data/lib/emoji/kddi.rb +1306 -0
- data/lib/emoji/softbank.rb +496 -0
- data/lib/emoji/unicode_symbol.rb +137 -0
- data/lib/forgery_ja.rb +5 -0
- data/lib/forgery_ja/dictionaries/docomo_ip +8 -0
- data/lib/forgery_ja/dictionaries/google_emoji +176 -0
- data/lib/forgery_ja/dictionaries/kddi_ip +42 -0
- data/lib/forgery_ja/dictionaries/softbank_ip +3 -0
- data/lib/forgery_ja/forgery_ja/address.rb +7 -11
- data/lib/forgery_ja/forgery_ja/mobile.rb +139 -0
- data/lib/forgery_ja/version.rb +1 -1
- data/spec/forgery_ja/address_spec.rb +35 -33
- data/spec/forgery_ja/mobile_spec.rb +99 -0
- data/spec/spec_helper.rb +1 -0
- metadata +13 -2
data/lib/forgery_ja/version.rb
CHANGED
@@ -35,6 +35,7 @@ describe ForgeryJa::Address do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe ".state" do
|
38
|
+
|
38
39
|
context "ForgeryJa::KANJIを指定したとき" do
|
39
40
|
subject { ForgeryJa(:address).state(:to => ForgeryJa::KANJI) }
|
40
41
|
it { should match /^[一-龠]+$/ }
|
@@ -68,82 +69,83 @@ describe ForgeryJa::Address do
|
|
68
69
|
it { should be_kind_of(String) }
|
69
70
|
end
|
70
71
|
context "ForgeryJa::ARRAYを指定し、blankをtrueにしたとき" do
|
71
|
-
|
72
|
-
it {
|
73
|
-
it {
|
74
|
-
it {
|
72
|
+
let(:res){ ForgeryJa(:address).full_address(:to => ForgeryJa::ARRAY, :blank => true) }
|
73
|
+
it { res.should be_kind_of(Array) }
|
74
|
+
it { res.should have(5).items }
|
75
|
+
it { res[0].split(' ').should have(4).items }
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
78
79
|
describe ".address_list" do
|
79
80
|
context "何も指定しないとき" do
|
80
|
-
|
81
|
+
let(:res){ForgeryJa(:address).address_list }
|
81
82
|
it "4つのkeyをもつHash" do
|
82
|
-
|
83
|
-
|
83
|
+
res.should be_kind_of(Hash)
|
84
|
+
res.should have(4).items
|
84
85
|
end
|
85
86
|
it ":stateというkeyをもちvalueはArray" do
|
86
|
-
|
87
|
-
|
87
|
+
res.should be_has_key(:state)
|
88
|
+
res[:state].should be_kind_of(Array)
|
88
89
|
end
|
89
90
|
it ":cityというkeyをもちvalueはArray" do
|
90
|
-
|
91
|
-
|
91
|
+
res.should be_has_key(:city)
|
92
|
+
res[:city].should be_kind_of(Array)
|
92
93
|
end
|
93
94
|
it ":streetというkeyをもちvalueはArray" do
|
94
|
-
|
95
|
-
|
95
|
+
res.should be_has_key(:street)
|
96
|
+
res[:street].should be_kind_of(Array)
|
96
97
|
end
|
97
98
|
it ":numberというkeyをもちvalueはString" do
|
98
|
-
|
99
|
-
|
99
|
+
res.should be_has_key(:number)
|
100
|
+
res[:number].should be_kind_of(String)
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
103
104
|
context ":stateにfalseを指定したとき" do
|
104
|
-
|
105
|
+
let(:res){ ForgeryJa(:address).address_list(:state => false) }
|
105
106
|
it "3つのkeyをもつHash" do
|
106
|
-
|
107
|
-
|
107
|
+
res.should be_kind_of(Hash)
|
108
|
+
res.should have(3).items
|
108
109
|
end
|
109
110
|
it ":stateというkeyはもたない" do
|
110
|
-
|
111
|
+
res.should_not be_has_key(:state)
|
111
112
|
end
|
112
113
|
end
|
113
114
|
|
114
115
|
context ":cityにfalseを指定したとき" do
|
115
|
-
|
116
|
+
let(:res){ ForgeryJa(:address).address_list(:city => false) }
|
116
117
|
it "3つのkeyをもつHash" do
|
117
|
-
|
118
|
-
|
118
|
+
res.should be_kind_of(Hash)
|
119
|
+
res.should have(3).items
|
119
120
|
end
|
120
121
|
it ":cityというkeyはもたない" do
|
121
|
-
|
122
|
+
res.should_not be_has_key(:city)
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
126
|
context ":street,:cityにfalseを指定したとき" do
|
126
|
-
|
127
|
+
let(:res){ ForgeryJa(:address).address_list(:city => false, :street => false) }
|
127
128
|
it "2つのkeyをもつHash" do
|
128
|
-
|
129
|
-
|
129
|
+
res.should be_kind_of(Hash)
|
130
|
+
res.should have(2).items
|
130
131
|
end
|
131
132
|
it ":city,:streetというkeyはもたない" do
|
132
|
-
|
133
|
-
|
133
|
+
res.should_not be_has_key(:city)
|
134
|
+
res.should_not be_has_key(:street)
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
137
138
|
context ":number,:stateにfalseを指定したとき" do
|
138
|
-
|
139
|
+
let(:res){ ForgeryJa(:address).address_list(:state => false, :number => false) }
|
139
140
|
it "2つのkeyをもつHash" do
|
140
|
-
|
141
|
-
|
141
|
+
res.should be_kind_of(Hash)
|
142
|
+
res.should have(2).items
|
142
143
|
end
|
143
144
|
it ":number,:stateというkeyはもたない" do
|
144
|
-
|
145
|
-
|
145
|
+
res.should_not be_has_key(:number)
|
146
|
+
res.should_not be_has_key(:state)
|
146
147
|
end
|
147
148
|
end
|
149
|
+
|
148
150
|
end
|
149
151
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ForgeryJa::Mobile do
|
5
|
+
describe ".emoji_unicode" do
|
6
|
+
it { ForgeryJa(:mobile).emoji_unicode.should be_kind_of(String) }
|
7
|
+
it { ForgeryJa(:mobile).emoji_unicode(:docomo => false).should be_kind_of(String) }
|
8
|
+
it { ForgeryJa(:mobile).emoji_unicode(:kddi => false).should be_kind_of(String) }
|
9
|
+
it { ForgeryJa(:mobile).emoji_unicode(:softbank => false).should be_kind_of(String) }
|
10
|
+
it { ForgeryJa(:mobile).emoji_unicode(:google => true).should be_kind_of(String) }
|
11
|
+
it { ForgeryJa(:mobile).emoji_unicode(:docomo => false, :kddi => false, :softbank => false).should be_nil }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".emoji_sjis" do
|
15
|
+
it { ForgeryJa(:mobile).emoji_sjis.should be_kind_of(String) }
|
16
|
+
it { ForgeryJa(:mobile).emoji_sjis(:docomo => false).should be_kind_of(String) }
|
17
|
+
it { ForgeryJa(:mobile).emoji_sjis(:kddi => false).should be_kind_of(String) }
|
18
|
+
it { ForgeryJa(:mobile).emoji_sjis(:softbank => false).should be_kind_of(String) }
|
19
|
+
it { ForgeryJa(:mobile).emoji_sjis(:docomo => false, :kddi => false, :softbank => false).should be_nil }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe ".phone_number" do
|
23
|
+
context "何も指定しないとき" do
|
24
|
+
subject { ForgeryJa(:mobile).phone_number }
|
25
|
+
it { should be_kind_of(String) }
|
26
|
+
it { should match /^0[987]0-[0-9]{4}-[0-9]{4}/}
|
27
|
+
end
|
28
|
+
context "hyphenにtrueを指定したとき" do
|
29
|
+
subject { ForgeryJa(:mobile).phone_number(:hyphen => false) }
|
30
|
+
it { should be_kind_of(String) }
|
31
|
+
it { should match /^0[987]0[0-9]{4}[0-9]{4}/}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe ".ip" do
|
36
|
+
it { ForgeryJa(:mobile).ip.should be_kind_of(String) }
|
37
|
+
it { ForgeryJa(:mobile).ip(:docomo => false).should be_kind_of(String) }
|
38
|
+
it { ForgeryJa(:mobile).ip(:docomo => false, :kddi => false, :softbank => false).should be_nil }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ".emoji_docomo_unicode" do
|
42
|
+
it "Stringがかえること" do
|
43
|
+
ForgeryJa(:mobile).emoji_docomo_unicode.should be_kind_of(String)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe ".emoji_docomo_sjis" do
|
48
|
+
it "Stringがかえること" do
|
49
|
+
ForgeryJa(:mobile).emoji_docomo_sjis.should be_kind_of(String)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe ".emoji_kddi_unicode" do
|
54
|
+
it "Stringがかえること" do
|
55
|
+
ForgeryJa(:mobile).emoji_kddi_unicode.should be_kind_of(String)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe ".emoji_kddi_sjis" do
|
60
|
+
it "Stringがかえること" do
|
61
|
+
ForgeryJa(:mobile).emoji_kddi_sjis.should be_kind_of(String)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe ".emoji_softbank_unicode" do
|
66
|
+
it "Stringがかえること" do
|
67
|
+
ForgeryJa(:mobile).emoji_softbank_unicode.should be_kind_of(String)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe ".emoji_kddi_sjis" do
|
72
|
+
it "Stringがかえること" do
|
73
|
+
ForgeryJa(:mobile).emoji_softbank_sjis.should be_kind_of(String)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe ".emoji_google_unicode" do
|
78
|
+
it "Stringがかえること" do
|
79
|
+
ForgeryJa(:mobile).emoji_google_unicode.should be_kind_of(String)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe ".docomo_ip" do
|
84
|
+
subject { ForgeryJa(:mobile).docomo_ip }
|
85
|
+
it { should be_kind_of(String) }
|
86
|
+
it { should match /^[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]/ }
|
87
|
+
end
|
88
|
+
describe ".kddi_ip" do
|
89
|
+
subject { ForgeryJa(:mobile).kddi_ip }
|
90
|
+
it { should be_kind_of(String) }
|
91
|
+
it { should match /^[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]/ }
|
92
|
+
end
|
93
|
+
describe ".softbank_ip" do
|
94
|
+
subject { ForgeryJa(:mobile).softbank_ip }
|
95
|
+
it { should be_kind_of(String) }
|
96
|
+
it { should match /^[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]\.[1-2]*[0-9]*[0-9]/ }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: forgery_ja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- namakesugi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-14 00:00:00 +09:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -56,20 +56,30 @@ files:
|
|
56
56
|
- Rakefile
|
57
57
|
- forgery_ja.gemspec
|
58
58
|
- init.rb
|
59
|
+
- lib/emoji/docomo.rb
|
60
|
+
- lib/emoji/google.rb
|
61
|
+
- lib/emoji/kddi.rb
|
62
|
+
- lib/emoji/softbank.rb
|
63
|
+
- lib/emoji/unicode_symbol.rb
|
59
64
|
- lib/forgery_ja.rb
|
60
65
|
- lib/forgery_ja/constant.rb
|
61
66
|
- lib/forgery_ja/dictionaries/cities_ja
|
62
67
|
- lib/forgery_ja/dictionaries/company_names_ja
|
68
|
+
- lib/forgery_ja/dictionaries/docomo_ip
|
63
69
|
- lib/forgery_ja/dictionaries/female_first_names_ja
|
70
|
+
- lib/forgery_ja/dictionaries/google_emoji
|
64
71
|
- lib/forgery_ja/dictionaries/job_titles_ja
|
72
|
+
- lib/forgery_ja/dictionaries/kddi_ip
|
65
73
|
- lib/forgery_ja/dictionaries/last_names_ja
|
66
74
|
- lib/forgery_ja/dictionaries/male_first_names_ja
|
67
75
|
- lib/forgery_ja/dictionaries/name_titles_ja
|
76
|
+
- lib/forgery_ja/dictionaries/softbank_ip
|
68
77
|
- lib/forgery_ja/dictionaries/states_ja
|
69
78
|
- lib/forgery_ja/dictionaries/streets_ja
|
70
79
|
- lib/forgery_ja/forgery_ja.rb
|
71
80
|
- lib/forgery_ja/forgery_ja/address.rb
|
72
81
|
- lib/forgery_ja/forgery_ja/date.rb
|
82
|
+
- lib/forgery_ja/forgery_ja/mobile.rb
|
73
83
|
- lib/forgery_ja/forgery_ja/monetary.rb
|
74
84
|
- lib/forgery_ja/forgery_ja/name.rb
|
75
85
|
- lib/forgery_ja/forgery_ja_api.rb
|
@@ -77,6 +87,7 @@ files:
|
|
77
87
|
- lib/forgery_ja/version.rb
|
78
88
|
- spec/forgery_ja/address_spec.rb
|
79
89
|
- spec/forgery_ja/date_spec.rb
|
90
|
+
- spec/forgery_ja/mobile_spec.rb
|
80
91
|
- spec/forgery_ja/monetary_spec.rb
|
81
92
|
- spec/forgery_ja/name_spec.rb
|
82
93
|
- spec/spec_helper.rb
|