साथ namespaced नियंत्रक नेस्ट मुझे लगता है कि कोड इस मामले में शब्दों से अधिक बात करेंगे, तो जगह कोड के लिए:परीक्षण RSpec 2 और Rails3
config/routes.rb
namespace :embed do
namespace :v1 do
resources :articles
end
end
एप्लिकेशन/नियंत्रक/एम्बेड/v1/articles_controller.rb
class Embed::V1::ArticlesController < ApplicationController
def index
render :text => 'ok'
end
end
spe c/नियंत्रक/एम्बेड/v1/articles_controller_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
describe Embed::V1::ArticlesController do
it "should do something" do
get :new
end
end
rspec spec
$ rspec spec
F
Failures:
1) Embed::V1::ArticlesController should do something
Failure/Error: get :new
AbstractController::ActionNotFound:
The action 'new' could not be found for Embed::V1::ArticlesController
# ./spec/controllers/embed/v1/articles_controller_spec.rb:5
Finished in 0.01665 seconds
1 example, 1 failure
किसी भी विचार क्यों है कि हो गए हैं? क्या एक घोंसला सीमा है? यूआरएल तक पहुंचना http://0.0.0.0:3000/embed/v1/articlesठीक प्रस्तुत करता है।