forgery_ja 0.2.1 → 0.2.2

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.
@@ -1,4 +1,4 @@
1
1
  class ForgeryJa
2
2
  # version number
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
@@ -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
- before(:all) { @res = ForgeryJa(:address).full_address(:to => ForgeryJa::ARRAY, :blank => true) }
72
- it { @res.should be_kind_of(Array) }
73
- it { @res.should have(5).items }
74
- it { @res[0].split(' ').should have(4).items }
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
- before(:all) { @res = ForgeryJa(:address).address_list }
81
+ let(:res){ForgeryJa(:address).address_list }
81
82
  it "4つのkeyをもつHash" do
82
- @res.should be_kind_of(Hash)
83
- @res.should have(4).items
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
- @res.should be_has_key(:state)
87
- @res[:state].should be_kind_of(Array)
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
- @res.should be_has_key(:city)
91
- @res[:city].should be_kind_of(Array)
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
- @res.should be_has_key(:street)
95
- @res[:street].should be_kind_of(Array)
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
- @res.should be_has_key(:number)
99
- @res[:number].should be_kind_of(String)
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
- before(:all) { @res = ForgeryJa(:address).address_list(:state => false) }
105
+ let(:res){ ForgeryJa(:address).address_list(:state => false) }
105
106
  it "3つのkeyをもつHash" do
106
- @res.should be_kind_of(Hash)
107
- @res.should have(3).items
107
+ res.should be_kind_of(Hash)
108
+ res.should have(3).items
108
109
  end
109
110
  it ":stateというkeyはもたない" do
110
- @res.should_not be_has_key(:state)
111
+ res.should_not be_has_key(:state)
111
112
  end
112
113
  end
113
114
 
114
115
  context ":cityにfalseを指定したとき" do
115
- before(:all) { @res = ForgeryJa(:address).address_list(:city => false) }
116
+ let(:res){ ForgeryJa(:address).address_list(:city => false) }
116
117
  it "3つのkeyをもつHash" do
117
- @res.should be_kind_of(Hash)
118
- @res.should have(3).items
118
+ res.should be_kind_of(Hash)
119
+ res.should have(3).items
119
120
  end
120
121
  it ":cityというkeyはもたない" do
121
- @res.should_not be_has_key(:city)
122
+ res.should_not be_has_key(:city)
122
123
  end
123
124
  end
124
125
 
125
126
  context ":street,:cityにfalseを指定したとき" do
126
- before(:all) { @res = ForgeryJa(:address).address_list(:city => false, :street => false) }
127
+ let(:res){ ForgeryJa(:address).address_list(:city => false, :street => false) }
127
128
  it "2つのkeyをもつHash" do
128
- @res.should be_kind_of(Hash)
129
- @res.should have(2).items
129
+ res.should be_kind_of(Hash)
130
+ res.should have(2).items
130
131
  end
131
132
  it ":city,:streetというkeyはもたない" do
132
- @res.should_not be_has_key(:city)
133
- @res.should_not be_has_key(:street)
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
- before(:all) { @res = ForgeryJa(:address).address_list(:state => false, :number => false) }
139
+ let(:res){ ForgeryJa(:address).address_list(:state => false, :number => false) }
139
140
  it "2つのkeyをもつHash" do
140
- @res.should be_kind_of(Hash)
141
- @res.should have(2).items
141
+ res.should be_kind_of(Hash)
142
+ res.should have(2).items
142
143
  end
143
144
  it ":number,:stateというkeyはもたない" do
144
- @res.should_not be_has_key(:number)
145
- @res.should_not be_has_key(:state)
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
+
@@ -1,2 +1,3 @@
1
1
  require 'rspec'
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../init')
3
+ require 'tapp'
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.1
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-06 00:00:00 +09:00
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