jpp_customercode_transfer 0.0.1 → 0.0.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.
- data/README.md +46 -0
- data/app/models/jpp_customercode_transfer/zip_code_list.rb +22 -13
- data/db/migrate/20120401133633_create_jpp_customercode_transfer_zip_code_lists.rb +1 -1
- data/lib/jpp_customercode_transfer/version.rb +1 -1
- data/spec/csv/temp_ken_all.sjis.csv +2 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test → spec}/dummy/config/application.rb +0 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/{test → spec}/dummy/config/routes.rb +0 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +36 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +5025 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/{test → spec}/dummy/script/rails +0 -0
- data/spec/fixtures/jpp_customercode_transfer_zip_code_lists.yml +241 -0
- data/spec/models/jpp_customercode_transfer/zip_code_list_spec.rb +177 -0
- data/spec/spec_helper.rb +24 -0
- metadata +83 -77
- data/README.rdoc +0 -3
- data/test/fixtures/jpp_customercode_transfer/zip_code_lists.yml +0 -11
- data/test/integration/navigation_test.rb +0 -10
- data/test/jpp_customercode_transfer_test.rb +0 -7
- data/test/test_helper.rb +0 -15
- data/test/unit/jpp_customercode_transfer/zip_code_list_test.rb +0 -9
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,241 @@
|
|
1
|
+
---
|
2
|
+
zip_code_list_0001:
|
3
|
+
union_code: 1101
|
4
|
+
zipcode: "0640804"
|
5
|
+
prefecture_name: "北海道"
|
6
|
+
city_name: "札幌市中央区"
|
7
|
+
region_name: "南四条西"
|
8
|
+
flag10: 0
|
9
|
+
flag11: 0
|
10
|
+
flag12: 1
|
11
|
+
flag13: 0
|
12
|
+
flag14: 0
|
13
|
+
update_flag: 0
|
14
|
+
created_at: 2012-03-14 05:22:14.469691 Z
|
15
|
+
updated_at: 2012-03-14 05:22:14.469691 Z
|
16
|
+
zip_code_list_0002:
|
17
|
+
union_code: 1207
|
18
|
+
zipcode5:
|
19
|
+
zipcode: "0800831"
|
20
|
+
prefecture_name: "北海道"
|
21
|
+
city_name: "帯広市"
|
22
|
+
region_name: "稲田町南"
|
23
|
+
flag10: 0
|
24
|
+
flag11: 0
|
25
|
+
flag12: 0
|
26
|
+
flag13: 0
|
27
|
+
flag14: 0
|
28
|
+
update_flag: 0
|
29
|
+
created_at: 2012-03-14 05:22:34.174765 Z
|
30
|
+
updated_at: 2012-03-14 05:22:34.174765 Z
|
31
|
+
zip_code_list_0003:
|
32
|
+
union_code: 3202
|
33
|
+
zipcode5:
|
34
|
+
zipcode: "0270203"
|
35
|
+
prefecture_name: "岩手県"
|
36
|
+
city_name: "宮古市"
|
37
|
+
region_name: "津軽石"
|
38
|
+
flag10: 0
|
39
|
+
flag11: 1
|
40
|
+
flag12: 0
|
41
|
+
flag13: 0
|
42
|
+
flag14: 0
|
43
|
+
update_flag: 0
|
44
|
+
created_at: 2012-03-14 05:24:29.845146 Z
|
45
|
+
updated_at: 2012-03-14 05:24:29.845146 Z
|
46
|
+
zip_code_list_0004:
|
47
|
+
union_code: 8202
|
48
|
+
zipcode5:
|
49
|
+
zipcode: "3170055"
|
50
|
+
prefecture_name: "茨城県"
|
51
|
+
city_name: "日立市"
|
52
|
+
region_name: "宮田町"
|
53
|
+
flag10: 0
|
54
|
+
flag11: 0
|
55
|
+
flag12: 1
|
56
|
+
flag13: 0
|
57
|
+
flag14: 0
|
58
|
+
update_flag: 0
|
59
|
+
created_at: 2012-03-14 05:27:05.227432 Z
|
60
|
+
updated_at: 2012-03-14 05:27:05.227432 Z
|
61
|
+
zip_code_list_0005:
|
62
|
+
union_code: 12224
|
63
|
+
zipcode5:
|
64
|
+
zipcode: "2730102"
|
65
|
+
prefecture_name: "千葉県"
|
66
|
+
city_name: "鎌ケ谷市"
|
67
|
+
region_name: "右京塚"
|
68
|
+
flag10: 0
|
69
|
+
flag11: 0
|
70
|
+
flag12: 0
|
71
|
+
flag13: 0
|
72
|
+
flag14: 0
|
73
|
+
update_flag: 0
|
74
|
+
created_at: 2012-03-14 05:29:15.930127 Z
|
75
|
+
updated_at: 2012-03-14 05:29:15.930127 Z
|
76
|
+
zip_code_list_0006:
|
77
|
+
union_code: 13205
|
78
|
+
zipcode5:
|
79
|
+
zipcode: "1980036"
|
80
|
+
prefecture_name: "東京都"
|
81
|
+
city_name: "青梅市"
|
82
|
+
region_name: "河辺町"
|
83
|
+
flag10: 0
|
84
|
+
flag11: 0
|
85
|
+
flag12: 1
|
86
|
+
flag13: 0
|
87
|
+
flag14: 0
|
88
|
+
update_flag: 0
|
89
|
+
created_at: 2012-03-14 05:30:09.086591 Z
|
90
|
+
updated_at: 2012-03-14 05:30:09.086591 Z
|
91
|
+
zip_code_list_0007:
|
92
|
+
union_code: 18201
|
93
|
+
zipcode5:
|
94
|
+
zipcode: "9100067"
|
95
|
+
prefecture_name: "福井県"
|
96
|
+
city_name: "福井市"
|
97
|
+
region_name: "新田塚"
|
98
|
+
flag10: 0
|
99
|
+
flag11: 0
|
100
|
+
flag12: 1
|
101
|
+
flag13: 0
|
102
|
+
flag14: 0
|
103
|
+
update_flag: 0
|
104
|
+
created_at: 2012-03-14 05:32:56.983781 Z
|
105
|
+
updated_at: 2012-03-14 05:32:56.983781 Z
|
106
|
+
zip_code_list_0008:
|
107
|
+
union_code: 26203
|
108
|
+
zipcode5:
|
109
|
+
zipcode: "6230011"
|
110
|
+
prefecture_name: "京都府"
|
111
|
+
city_name: "綾部市"
|
112
|
+
region_name: "青野町"
|
113
|
+
flag10: 0
|
114
|
+
flag11: 0
|
115
|
+
flag12: 0
|
116
|
+
flag13: 0
|
117
|
+
flag14: 0
|
118
|
+
update_flag: 0
|
119
|
+
created_at: 2012-03-14 05:38:31.964983 Z
|
120
|
+
updated_at: 2012-03-14 05:38:31.964983 Z
|
121
|
+
zip_code_list_0009:
|
122
|
+
union_code: 27141
|
123
|
+
zipcode5:
|
124
|
+
zipcode: "5900016"
|
125
|
+
prefecture_name: "大阪府"
|
126
|
+
city_name: "堺市堺区"
|
127
|
+
region_name: "中田出井町"
|
128
|
+
flag10: 0
|
129
|
+
flag11: 0
|
130
|
+
flag12: 1
|
131
|
+
flag13: 0
|
132
|
+
flag14: 0
|
133
|
+
update_flag: 0
|
134
|
+
created_at: 2012-03-14 05:38:58.962758 Z
|
135
|
+
updated_at: 2012-03-14 05:38:58.962758 Z
|
136
|
+
zip_code_list_0010:
|
137
|
+
union_code: 28110
|
138
|
+
zipcode5:
|
139
|
+
zipcode: "6500046"
|
140
|
+
prefecture_name: "兵庫県"
|
141
|
+
city_name: "神戸市中央区"
|
142
|
+
region_name: "港島中町"
|
143
|
+
flag10: 0
|
144
|
+
flag11: 0
|
145
|
+
flag12: 1
|
146
|
+
flag13: 0
|
147
|
+
flag14: 0
|
148
|
+
update_flag: 0
|
149
|
+
created_at: 2012-03-14 05:39:39.307265 Z
|
150
|
+
updated_at: 2012-03-14 05:39:39.307265 Z
|
151
|
+
zip_code_list_0011:
|
152
|
+
union_code: 12103
|
153
|
+
zipcode5:
|
154
|
+
zipcode: "2630023"
|
155
|
+
prefecture_name: "千葉県"
|
156
|
+
city_name: "千葉市稲毛区"
|
157
|
+
region_name: "緑町"
|
158
|
+
flag10: 0
|
159
|
+
flag11: 0
|
160
|
+
flag12: 1
|
161
|
+
flag13: 0
|
162
|
+
flag14: 0
|
163
|
+
update_flag: 0
|
164
|
+
created_at: 2012-03-14 05:28:52.534689 Z
|
165
|
+
updated_at: 2012-03-14 05:39:39.307265 Z
|
166
|
+
zip_code_list_0012:
|
167
|
+
union_code: 5212
|
168
|
+
zipcode5:
|
169
|
+
zipcode: "0140113"
|
170
|
+
prefecture_name: "秋田県"
|
171
|
+
city_name: "大仙市"
|
172
|
+
region_name: "堀見内"
|
173
|
+
flag10: 0
|
174
|
+
flag11: 1
|
175
|
+
flag12: 0
|
176
|
+
flag13: 0
|
177
|
+
flag14: 0
|
178
|
+
update_flag: 0
|
179
|
+
created_at: 2012-03-14 05:25:47.628140 Z
|
180
|
+
updated_at: 2012-03-14 05:25:47.628140 Z
|
181
|
+
zip_code_list_0013:
|
182
|
+
union_code: 13106
|
183
|
+
zipcode5:
|
184
|
+
zipcode: "1100016"
|
185
|
+
prefecture_name: "東京都"
|
186
|
+
city_name: "台東区"
|
187
|
+
region_name: "台東"
|
188
|
+
flag10: 0
|
189
|
+
flag11: 0
|
190
|
+
flag12: 1
|
191
|
+
flag13: 0
|
192
|
+
flag14: 0
|
193
|
+
update_flag: 0
|
194
|
+
created_at: 2012-03-14 05:29:56.852526 Z
|
195
|
+
updated_at: 2012-03-14 05:29:56.852526 Z
|
196
|
+
zip_code_list_0014:
|
197
|
+
union_code: 1103
|
198
|
+
zipcode5:
|
199
|
+
zipcode: "0600906"
|
200
|
+
prefecture_name: "北海道"
|
201
|
+
city_name: "札幌市東区"
|
202
|
+
region_name: "北六条東(1〜7丁目)"
|
203
|
+
flag10: 1
|
204
|
+
flag11: 0
|
205
|
+
flag12: 1
|
206
|
+
flag13: 0
|
207
|
+
flag14: 0
|
208
|
+
update_flag: 0
|
209
|
+
created_at: 2012-03-14 05:22:16.665289 Z
|
210
|
+
updated_at: 2012-03-14 05:22:16.665289 Z
|
211
|
+
zip_code_list_0015:
|
212
|
+
union_code: 1103
|
213
|
+
zipcode5:
|
214
|
+
zipcode: "0650006"
|
215
|
+
prefecture_name: "北海道"
|
216
|
+
city_name: "札幌市東区"
|
217
|
+
region_name: "北六条東(8〜20丁目)"
|
218
|
+
flag10: 1
|
219
|
+
flag11: 0
|
220
|
+
flag12: 1
|
221
|
+
flag13: 0
|
222
|
+
flag14: 0
|
223
|
+
update_flag: 0
|
224
|
+
created_at: 2012-03-14 05:22:16.674888 Z
|
225
|
+
updated_at: 2012-03-14 05:22:16.674888 Z
|
226
|
+
zip_code_list_0016:
|
227
|
+
union_code: 19207
|
228
|
+
zipcode5:
|
229
|
+
zipcode: "4070033"
|
230
|
+
prefecture_name: "山梨県"
|
231
|
+
city_name: "韮崎市"
|
232
|
+
region_name: "龍岡町下條南割"
|
233
|
+
flag10: 0
|
234
|
+
flag11: 0
|
235
|
+
flag12: 0
|
236
|
+
flag13: 0
|
237
|
+
flag14: 0
|
238
|
+
update_flag: 0
|
239
|
+
created_at: 2012-03-14 05:33:22.734536 Z
|
240
|
+
updated_at: 2012-03-14 05:33:22.734536 Z
|
241
|
+
|
@@ -0,0 +1,177 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe JppCustomercodeTransfer::ZipCodeList do
|
5
|
+
fixtures :jpp_customercode_transfer_zip_code_lists
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@importfile_path = "#{::Rails.root}/../../spec/csv"
|
9
|
+
end
|
10
|
+
|
11
|
+
context "import zipcode file" do
|
12
|
+
it "should raise argument error (1)" do
|
13
|
+
proc {
|
14
|
+
JppCustomercodeTransfer::ZipCodeList.import
|
15
|
+
}.should raise_error(ArgumentError, "filename is blank.")
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should raise argument error (2)" do
|
20
|
+
proc {
|
21
|
+
JppCustomercodeTransfer::ZipCodeList.import("")
|
22
|
+
}.should raise_error(ArgumentError, "filename is blank.")
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should raise argument error (no exist file)" do
|
27
|
+
proc {
|
28
|
+
JppCustomercodeTransfer::ZipCodeList.import("nofile.csv")
|
29
|
+
}.should raise_error(Errno::ENOENT, "No such file or directory - nofile.csv")
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should import success 2 records." do
|
34
|
+
JppCustomercodeTransfer::ZipCodeList.import(File.join([@importfile_path, "temp_ken_all.sjis.csv"]))
|
35
|
+
JppCustomercodeTransfer::ZipCodeList.find(:all).count.should eq 2
|
36
|
+
|
37
|
+
zip_code_lists = JppCustomercodeTransfer::ZipCodeList.find(:all, :order=>'zipcode asc')
|
38
|
+
|
39
|
+
zip_code_lists.first.union_code.should eq "01101"
|
40
|
+
zip_code_lists.first.zipcode5.should eq "060 "
|
41
|
+
zip_code_lists.first.zipcode.should eq "0600000"
|
42
|
+
zip_code_lists.first.prefecture_name.should eq "北海道"
|
43
|
+
|
44
|
+
zip_code_lists.second.union_code.should eq "01101"
|
45
|
+
zip_code_lists.second.zipcode5.should eq "064 "
|
46
|
+
zip_code_lists.second.zipcode.should eq "0640941"
|
47
|
+
zip_code_lists.second.prefecture_name.should eq "北海道"
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
context "generate barcode" do
|
54
|
+
|
55
|
+
it "shoud raise exception (1)" do
|
56
|
+
proc {
|
57
|
+
JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(nil , nil)
|
58
|
+
}.should raise_error(ArgumentError, "zip_code or address is empty.")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "shoud raise exception (2)" do
|
62
|
+
proc {
|
63
|
+
JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code("3340021" , nil)
|
64
|
+
}.should raise_error(ArgumentError, "zip_code or address is empty.")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "shoud raise exception (3)" do
|
68
|
+
proc {
|
69
|
+
JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code("113-0021" , "東京都文京区本駒込6-1-21")
|
70
|
+
}.should raise_error(ArgumentError, "zip_code is invalid. (no record)")
|
71
|
+
end
|
72
|
+
|
73
|
+
it "shoud return customer code (1)" do
|
74
|
+
h = {:z=>"263-0023", :a=>"千葉市稲毛区緑町3丁目30-8 郵便ビル403号", :ans=>"26300233-30-8-403"}
|
75
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
76
|
+
ans.should eq h[:ans]
|
77
|
+
end
|
78
|
+
|
79
|
+
it "shoud return customer code (2)" do
|
80
|
+
h = {:z=>"014-0113", :a=>"秋田県大仙市堀見内 南田茂木 添60-1", :ans=>"014011360-1"}
|
81
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
82
|
+
ans.should eq h[:ans]
|
83
|
+
end
|
84
|
+
|
85
|
+
it "shoud return customer code (3)" do
|
86
|
+
h = {:z=>"110-0016", :a=>"東京都台東区台東5-6-3 ABCビル10F", :ans=>"11000165-6-3-10"}
|
87
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
88
|
+
ans.should eq h[:ans]
|
89
|
+
end
|
90
|
+
|
91
|
+
it "shoud return customer code (4)" do
|
92
|
+
h = {:z=>"060-0906", :a=>"北海道札幌市東区北六条東4丁目 郵便センター6号館", :ans=>"06009064-6"}
|
93
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
94
|
+
ans.should eq h[:ans]
|
95
|
+
end
|
96
|
+
|
97
|
+
it "shoud return customer code (5)" do
|
98
|
+
h = {:z=>"065-0006", :a=>"北海道札幌市東区北六条東8丁目 郵便センター10号館", :ans=>"06500068-10"}
|
99
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
100
|
+
ans.should eq h[:ans]
|
101
|
+
end
|
102
|
+
|
103
|
+
it "shoud return customer code (6)" do
|
104
|
+
h = {:z=>"407-0033", :a=>"山梨県韮崎市龍岡町下條南割 韮崎400", :ans=>"4070033400"}
|
105
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
106
|
+
ans.should eq h[:ans]
|
107
|
+
end
|
108
|
+
|
109
|
+
it "shoud return customer code (7)" do
|
110
|
+
h = {:z=>"2730102", :a=>"千葉県鎌ケ谷市右京塚 東3丁目-20-5 郵便・A&bコーポB604号", :ans=>"27301023-20-5B604"}
|
111
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
112
|
+
ans.should eq h[:ans]
|
113
|
+
end
|
114
|
+
|
115
|
+
it "shoud return customer code (8)" do
|
116
|
+
h = {:z=>"1980036", :a=>"東京都青梅市河辺町十一丁目六番地一号 郵便タワー601", :ans=>"198003611-6-1-601"}
|
117
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
118
|
+
ans.should eq h[:ans]
|
119
|
+
end
|
120
|
+
|
121
|
+
it "shoud return customer code (9)" do
|
122
|
+
h = {:z=>"0270203", :a=>"岩手県宮古市大字津軽石第二十一地割大淵川480", :ans=>"027020321-480"}
|
123
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
124
|
+
ans.should eq h[:ans]
|
125
|
+
end
|
126
|
+
|
127
|
+
it "shoud return customer code (10)" do
|
128
|
+
h = {:z=>"5900016", :a=>"大阪府堺市堺区中田出井町四丁六番十九号", :ans=>"59000164-6-19"}
|
129
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
130
|
+
ans.should eq h[:ans]
|
131
|
+
end
|
132
|
+
|
133
|
+
it "shoud return customer code (11)" do
|
134
|
+
h = {:z=>"0800831", :a=>"北海道帯広市稲田町南七線 西28", :ans=>"08008317-28"}
|
135
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
136
|
+
ans.should eq h[:ans]
|
137
|
+
end
|
138
|
+
|
139
|
+
it "shoud return customer code (12)" do
|
140
|
+
h = {:z=>"3170055", :a=>"茨城県日立市宮田町6丁目7-14 ABCビル2F", :ans=>"31700556-7-14-2"}
|
141
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
142
|
+
ans.should eq h[:ans]
|
143
|
+
end
|
144
|
+
|
145
|
+
it "shoud return customer code (13)" do
|
146
|
+
h = {:z=>"6500046", :a=>"神戸市中央区港島中町9丁目7-6 郵便シティA棟1F1号", :ans=>"65000469-7-6A1-1"}
|
147
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
148
|
+
ans.should eq h[:ans]
|
149
|
+
end
|
150
|
+
|
151
|
+
it "shoud return customer code (14)" do
|
152
|
+
h = {:z=>"6230011", :a=>"京都府綾部市青野町綾部6-7 LプラザB106", :ans=>"62300116-7LB106"}
|
153
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
154
|
+
ans.should eq h[:ans]
|
155
|
+
end
|
156
|
+
|
157
|
+
it "shoud return customer code (15)" do
|
158
|
+
h = {:z=>"2280024", :a=>"神奈川県座間市入谷6丁目3454-5 郵便ハイツ6-1108", :ans=>"22800246-3454-5-6-112"}
|
159
|
+
proc {
|
160
|
+
JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
161
|
+
}.should raise_error(ArgumentError, "zip_code is invalid. (no record)")
|
162
|
+
end
|
163
|
+
|
164
|
+
it "shoud return customer code (16)" do
|
165
|
+
h = {:z=>"0640804", :a=>"札幌市中央区南四条西29丁目1524-23 第2郵便ハウス501", :ans=>"064080429-1524-23-2-3"}
|
166
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
167
|
+
ans.should eq h[:ans]
|
168
|
+
end
|
169
|
+
|
170
|
+
it "shoud return customer code (17)" do
|
171
|
+
h = {:z=>"9100067", :a=>"福井県福井市新田塚3丁目80-25 J1ビル2-B", :ans=>"91000673-80-25J1-2B"}
|
172
|
+
ans = JppCustomercodeTransfer::ZipCodeList.generate_japanpost_customer_code(h[:z], h[:a])
|
173
|
+
ans.should eq h[:ans]
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper.rb"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
ENV["RAILS_ENV"] ||= 'test'
|
9
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
10
|
+
require 'rspec/rails'
|
11
|
+
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
13
|
+
# # in spec/support/ and its subdirectories.
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
18
|
+
config.run_all_when_everything_filtered = true
|
19
|
+
config.filter_run :focus
|
20
|
+
|
21
|
+
config.mock_with :rspec
|
22
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
23
|
+
#config.use_transactional_fixtures = true
|
24
|
+
end
|