Rails 4 beta1 アプリケーションに複数の Rails エンジンがあります。私はrspec-rails
すべてのエンジンにgemをインストールしています。そして、次のコマンドでエンジンを作成しました。
rails plugin new store_frontend --dummy-path=spec/dummy -d postgresql --skip-test-unit --mountable
エンジンのダミー アプリケーションで、データベースとルートを構成しました。以下は、routes.rb ファイルの例です。
Rails.application.routes.draw do
mount StoreFrontend::Engine => "/store"
end
最初のエンジン内で rspec を実行すると、次のエラーが発生します。
1) StoreAdmin::DashboardController GET 'index' returns http success
Failure/Error: get 'index'
ActionController::UrlGenerationError:
No route matches {:action=>"index", :controller=>"store_admin/dashboard"}
# ./spec/controllers/store_admin/dashboard_controller_spec.rb:8:in `block (3 levels) in <module:StoreAdmin>'
そして、これが私のコントローラーテストです/Railsから生成されました/:
require 'spec_helper'
module StoreFrontend
describe HomeController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end
end
コントローラーのテストが機能していないようです。モデルテストがあり、正常に動作しています。何か案が?
更新 1: 私のアプリケーション構造:
bin/
config/
db/
lib/
log/
public/
tmp/
engine1/
engine2/
engine3/