describe "China district code"do context "district"do it "get province,city,area info" it "find citys by province" it "find areas by city" it "find province by city" it "find city,province by area" it "find area by district code" end
context "post code"do it "find post code by district code" end end
00:13:39 - INFO - Running: spec/china_district_code_spec.rb ******* Pending: (Failures listed here are expected and do not affect your suite's status) 1) China district code district get province,city,area info # Not yet implemented # ./spec/china_district_code_spec.rb:5 2) China district code district find citys by province # Not yet implemented # ./spec/china_district_code_spec.rb:6 3) China district code district find areas by city # Not yet implemented # ./spec/china_district_code_spec.rb:7 4) China district code district find province by city # Not yet implemented # ./spec/china_district_code_spec.rb:8 5) China district code district find city,province by area # Not yet implemented # ./spec/china_district_code_spec.rb:9 6) China district code district find area by district code # Not yet implemented # ./spec/china_district_code_spec.rb:10 7) China district code post code find post code by district code # Not yet implemented # ./spec/china_district_code_spec.rb:14 Finished in 0.00123 seconds (files took 0.14289 seconds to load) 7 examples, 0 failures, 7 pending
describe "China district code"do context "district"do it "get province,city,area info"do ChinaDistrictCode::load_china_district_code csv_folder_path = File.join(File.expand_path('../..',__FILE__),'lib','china_district_code','csv') provinces = CSV.read(File.join(csv_folder_path,'province.csv')) expect(provinces[0][0]).to eq('11') end it "find citys by province"do expect(ChinaDistrictCode::find_citys_by_province('河北省')).to include(["130100", "石家庄市"]) end it "find areas by city"do expect(ChinaDistrictCode::find_areas_by_city('石家庄市')).to include(["130103", "桥东区"]) end it "find province by city"do expect(ChinaDistrictCode::find_province_by_city('太原')).to eql(["140000", "山西省"]) end it "find city,province by area"do expect(ChinaDistrictCode::find_province_city_by_area('桥东区')).to eql([["130000", "河北省"], ["130100", "石家庄市"]]) end # it "find area by district code" end
context "post code"do it "find post code by district code" end end
#reload china district code from 'http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201401/t20140116_501070.html' def self.load_china_district_code DistrictHelper::get_china_district_code end
#find citys by province def self.find_citys_by_province(name) result = DistrictHelper::find_citys_by_province(name) puts result.to_s result end
#find areas by city def self.find_areas_by_city(name) result = DistrictHelper::find_areas_by_city(name) puts result.to_s result end
#find province by city def self.find_province_by_city(name) result = DistrictHelper::find_province_by_city(name) puts result.to_s result end
#find province,city by area def self.find_province_city_by_area(name) result = DistrictHelper::find_province_city_by_area(name) puts result.to_s result end end
-> ⮀ china_district_code ⮀ ⭠ master± ⮀ rake release china_district_code 0.0.1 built to pkg/china_district_code-0.0.1.gem. rake aborted! There are files that need to be committed first. /Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:131:in `guard_clean' /Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:60:in `block in install' Tasks: TOP => release => release:guard_clean (See full trace by running task with --trace)
✘ ⮀ -> ⮀ china_district_code ⮀ ⭠ master± ⮀ rake release china_district_code 0.0.1 built to pkg/china_district_code-0.0.1.gem. Tagged v0.0.1. Untagging v0.0.1 due to error. rake aborted! Couldn't git push. `git push ' failed with the following output:
fatal: No configured push destination. Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url> and then push using the remote name
git push <name>
/Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:121:in `perform_git_push' /Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:113:in `git_push' /Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:64:in `block (2 levels) in install' /Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:145:in `tag_version' /Users/dodoliu/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/gem_helper.rb:64:in `block in install' Tasks: TOP => release => release:source_control_push (See full trace by running task with --trace)
提交完成后,再次执行 rake release,看到以下内容则表示成功了.啦啦啦
1 2 3 4 5
-> ⮀ china_district_code ⮀ ⭠ master ⮀ rake release china_district_code 0.0.1 built to pkg/china_district_code-0.0.1.gem. Tagged v0.0.1. Pushed git commits and tags. Pushed china_district_code 0.0.1 to rubygems.org.