motephyr 10 years ago
parent
commit
4f5b0efd25
2 changed files with 2 additions and 3 deletions
  1. 1 2
      lib/taiwan_city.rb
  2. 1 1
      spec/controllers/taiwan_city/data_controller_spec.rb

+ 1 - 2
lib/taiwan_city.rb

@@ -34,8 +34,7 @@ module TaiwanCity
     end
 
     def city(code)
-      id_match = match(code)
-      "#{id_match[1]}#{id_match[2]}".ljust(5, '0')
+      match(code)[1].ljust(5, '0')
     end
 
     private

+ 1 - 1
spec/controllers/taiwan_city/data_controller_spec.rb

@@ -4,7 +4,7 @@ describe TaiwanCity::DataController do
 
   describe "GET 'show'" do
     it "returns http success" do
-      get 'show', id: '000', use_route: 'taiwan_city'
+      get 'show', id: '00000', use_route: 'taiwan_city'
       response.should be_success
     end
   end