0

我从我的测试中不明白这个错误 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
4

1 回答 1

0

您的控制器哈希不正确。你有:controllers => { :new => "new" },这就是说你希望你的“用户”模型通过一个名为“新”的控制器来处理。这应该更改为,例如:controllers => { :registrations => "registrations" },假设您的控制器的名称是“注册”

于 2012-07-16T19:48:44.883 回答