我已经覆盖了炼油厂的会话控制器,甚至还没有对其进行修改,因为我正试图为它编写一些规格。
控制器位于app / controllers / refinery / sessions_controller:
module Refinery
class SessionsController < Devise::SessionsController
....
def create
super
rescue ::BCrypt::Errors::InvalidSalt, ::BCrypt::Errors::InvalidHash
flash[:error] = t('password_encryption', :scope => 'refinery.users.forgot')
redirect_to refinery.new_refinery_user_password_path
end
.....
我正在尝试在spec / controllers / refinery / sessions_controller_spec.rb中针对此编写规范:
require 'spec_helper'
describe Refinery::SessionsController do
it "should post ok" do
post :create
response.should be_success
end
end
但是这给了我一个错误
No route matches {:action=>"create", :controller=>"refinery/sessions"}
这让我感到困惑,因为当我运行rake路线时,我得到以下一行:
refinery_user_session POST /refinery/users/login(.:format) refinery/sessions#create
有人可以帮忙吗?
Rails 3.2.8,refinery 2.0.8