0

谁能告诉我这个错误是什么意思:

失败/错误:访问 new_user_registration_path NameError: undefined local variable or method `new_user_registration_path' for # # ./spec/controllers/user_controller_spec.rb:10 # ./spec/controllers/user_controller_spec.rb:9

错误仅在我的规范外观的函数“lambda”上:

require 'spec_helper'

describe "User" do

describe "signup" do

describe "failure" do
  it "should not make a new user" do
    lambda do
      visit new_user_registration_path
      fill_in "email",        :with => ""
      fill_in "password",     :with => ""
      fill_in "password_confirmation", :with => ""
      click_button
      response.should render_template('users/new')
      response.should have_selector('div#error_explanation')
    end.should_not change(User, :count)
  end
end
....

我的路线 rake 说 new_user_registration 存在看起来

   cancel_user_registration GET    /users/cancel(.:format)                  devise/registrations#cancel
   user_registration POST   /users(.:format)                        devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)                devise/registrations#new
   edit_user_registration GET    /users/edit(.:format)                   devise/registrations#edit
...

任何想法?

4

1 回答 1

2

只需更换:

new_user_registration

和:

new_user_registration_path
于 2012-07-26T19:29:58.610 回答