我有這個控制器。登錄後錯誤的重定向
class SessionsController < Devise::SessionsController
# GET /resource/sign_in
def new
self.resource = build_resource(nil, :unsafe => true)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource))
end
# POST /resource/sign_in
def create
self.resource = warden.authenticate!(auth_options)
set_flash_message(:notice, :signed_in, :username => resource.username) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => after_sign_in_path_for(resource)
end
end
這一步defenitions黃瓜:
Given /^a user "(.*?)" exists$/ do |user_name|
@user = User.create!(:username => user_name , :password => "tamara")
end
When /^he logs in$/ do
visit("https://stackoverflow.com/users/sign_in")
fill_in('Username', :with => "roelof")
fill_in('Password', :with => "tamara")
click_button('Sign in')
end
Then /^he should see "(.*?)"$/ do |message|
page.should have_content(message)
end
一切只有經過全成登錄我得到重定向到網頁,而不是到登錄頁面succceed工作正常。所以我沒有看到閃光消息。
魯洛夫
編輯1:我檢查了控制器和RESOURCE_NAME和資源似乎有正確的價值觀。
我認爲一個愚蠢的問題,但我怎麼能檢查的範圍? –