繁体   English   中英

ActionController :: RoutingError:

[英]ActionController::RoutingError:

我无法从测试中了解此错误Failure/Error: get "new" ActionController::RoutingError: No route matches {:action=>"new", :controller=>"user"}

我的路线文件

Station::Application.routes.draw do devise_for :users, :controllers => { :new => "new" }

这是我的测试

require 'spec_helper'
describe UserController do

    it "should registrer new user" do
        get "new"
        fill_in "Email",                 :with => "abc@example.com"
        fill_in "Password",              :with => "abc123"
        click_button "Sign up"
        response.should have_content("Welcome! You have registrered successfully.")
    end 
end

您的控制器哈希不正确。 您有:controllers => { :new => "new" } ,这意味着您希望设计器通过名为“ new”的控制器来处理“用户”模型。 假设您的控制器名称为“ Registrations”,则应将其更改为例如:controllers => { :registrations => "registrations" }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM