このようなルートをバージョン管理しました
api_version(:module => "api/v1", :path => "api/v1") do
match '/files' => 'files#index', :via => :get
end
そして私のコントローラ app/controllers/api/v1/files_controller.rb
class Api::V1::FilesController < ApplicationController
def index
end
end
root/spec/controllers/api/v1/files_controller_spec.rb の仕様
require 'spec_helper'
describe Api::V1::FilesController do
describe "routing" do
it "should routes to version-1 api" do
expect(:get => "/api/v1/files").to route_to("api/v1/files#index")
end
end
end
コマンド rake routes は、このようなルートのリストを表示します
devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
api_v1_files GET /api/v1/files(.:format) api/v1/files#index
rake spec:controllers を実行するとスペックが落ちる。
F
Failures:
1) Api::V1::FilesController routing should routes to version-1 api
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `[]' for nil:NilClass
# /home/dilshod/.rvm/gems/ruby-1.9.2-p290/gems/moped-1.2.7/lib/moped/node.rb:74:in `block in command'
# /home/dilshod/.rvm/gems/ruby-1.9.2-p290/gems/moped-1.2.7/lib/moped/n
私は何を間違っていますか?