나는 Hartl의 RoR 튜토리얼을 통해 작업 해 왔고, 잠시 동안이 부분에 갇혀있다. 나는이 넣어지고 결국실패한 단언, 주어진 메시지 없음 : rails
$ bundle exec rake test
: 내가 가진 계정 활성화 테스트 실행하려고 여기
1) Failure:
UsersSignupTest#test_valid_signup_information_with_account_activation [/Users/*name/blogger1/test/integration/users_signup_test.rb:44]:
Failed assertion, no message given.
나의 users_signup_test.rb 파일에 내 테스트 코드입니다 :
require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: "",
email: "[email protected]",
password: "foo",
password_confirmation: "bar" }
end
assert_template 'users/new'
assert_select 'div#error_explanation'
assert_select 'div.field_with_errors'
end
test "valid signup information with account activation" do
get signup_path
assert_difference 'User.count', 1 do
post users_path, user: { name: "Example User",
email: "[email protected]",
password: "password",
password_confirmation: "password" }
end
assert_equal 1, ActionMailer::Base.deliveries.size
user = assigns(:user)
assert_not user.activated?
# Try to log in before activation.
log_in_as(user)
assert_not is_logged_in?
# Invalid activation token
get edit_account_activation_path("invalid token")
assert_not is_logged_in?
# Valid token, wrong email
get edit_account_activation_path(user.activation_token, email: 'wrong')
assert_not is_logged_in?
# Valid activation token
get edit_account_activation_path(user.activation_token, email: user.email)
assert user.reload.activated?
follow_redirect!
assert_template 'users/show'
assert is_logged_in?
end
end
튜토리얼을 따라 갔을 때 코드를 읽고 나서 직접 입력했습니다. 그러나 이번에는 모든 문제를 가지고 돌아가서 복사하고 붙여 넣었습니다. 어떤 아이디어가 될 수 있을까요?
라인 (44)은 다음과 같습니다
assert user.reload.activated?
하지만 다른 곳에서는 논리적 인 사람이어야했다 아무것도 찾을 수 없습니다?