设计忽略`after_sign_up_path_for`

时间:2014-10-21 23:50:46

标签: ruby-on-rails ruby-on-rails-4 devise

我有以下控制器

class Vendor::RegistrationsController < Devise::RegistrationsController

  def new
    redirect_to new_vendor_company_path
  end

  protected

  def after_sign_up_path_for(resource)
    vendor_company_quotes_path(resource.secret)
  end
end

和这个规范

describe "POST create" do
    it "should create a new vendor" do
      profile = attributes_for(:company)

      post :create, { company: profile }

      expect(response).to redirect_to vendor_company_quotes_path(assigns(:company).secret)
    end
  end

我的规格失败了,因为我没有重新定向到vendor_company_quotes_path。似乎设计忽略了我的压倒性方法 在有人问之前,我的路线是devise_for :companies, path: "vendors", controllers: { registrations: "vendor/registrations" }而我没有使用confirmable模块

1 个答案:

答案 0 :(得分:0)

将您的覆盖置于ApplicationController