@@ -0,0 +1,11 @@
+require_dependency "china_city/application_controller"
+
+module ChinaCity
+ class DataController < ApplicationController
+ layout nil
+ def show
+ data = ChinaCity.list(params[:id])
+ render json: data
+ end
+end
@@ -1,2 +1,4 @@
ChinaCity::Engine.routes.draw do
+ root to: 'data#show'
+ get ':id', to: 'data#show'
end
@@ -7,6 +7,7 @@ module ChinaCity
# g.fixture_replacement :factory_girl, dir: 'spec/factories'
g.assets false
g.helper false
+ g.view_specs false
@@ -0,0 +1,12 @@
+require 'spec_helper'
+describe ChinaCity::DataController do
+ describe "GET 'show'" do
+ it "returns http success" do
+ get 'show', id: '000000', use_route: 'china_city'
+ response.should be_success