【发布时间】:2015-09-13 21:34:18
【问题描述】:
当我在集成测试中有assert user_signed_in? 时,它说该方法未定义。有没有办法可以在我的测试中使用这种方法?我正在使用 rails 4 和最新版本的设计。这是我的测试文件:
require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test "valid signup information" do
get new_user_registration_path
assert_difference 'User.count', 1 do
post_via_redirect user_registration_path,
user: { first_name: "Example",
last_name: "User",
email: "user@example.org",
password: "password",
password_confirmation: "password" }
end
assert_template 'activities/index'
assert user_signed_in?
end
【问题讨论】:
-
我们需要的不止这些。请阅读有关如何创建最小、完整且可验证的示例的建议:stackoverflow.com/help/mcve
-
抱歉,已修复
标签: ruby-on-rails devise