ActionController的:: RoutingError:

时间:2012-07-16 19:38:47

标签: ruby-on-rails rspec routing

我从我的测试中不理解这个错误 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

1 个答案:

答案 0 :(得分:0)

您的控制器哈希值不正确。您有:controllers => { :new => "new" },这就是说您想要“用户”#39}。通过名为' new'的控制器设计处理的模型。这应该更改为,例如:controllers => { :registrations => "registrations" },假设您的控制器的名称是'注册'