2

単純なエンジンを作成します。すべて正常に動作しますが、エンジンのコントローラーの機能テストを記述しようとすると、次のようなエラーが発生します。

3) Error:
test_should_get_new(Supportilla::SessionsControllerTest):
ActionView::Template::Error: No route matches {}

私のテストファイル test/functional/supportilla/sessions_controller_test.rb:

require 'test_helper'

module Supportilla
  class SessionsControllerTest < ActionController::TestCase   
    test "should get new" do
      get "new", use_route: "supportilla"
      assert_response :success
    end

    test "should get create" do
      post :create, { session: { username: "test", password: "123"},
        use_route: :supportilla }
      assert_response :success
    end
    ...
  end
end

test/dummy/config/routes.rb にマウントされたエンジン:

mount Supportilla::Engine => "/supportilla"

レーキ ルート:

Routes for Supportilla::Engine:
    signin GET    /signin(.:format)             supportilla/sessions#new
   signout GET    /signout(.:format)            supportilla/sessions#destroy
           POST   /signin(.:format)             supportilla/sessions#create
       ...

私は非常に混乱しており、あなたの助けを願っています.

4

0 に答える 0