'Rails Failure ---expected +++ actual @@ -1 +1 @@
I am working on the Michael Hartl tutorial. When running my test, I get the following failure:
1) Failure:
SessionsHelperTest#test_current_user_returns_right_user_when_session_is_nil
[/home.../myapplication/test/helpers/sessions_helper_test.rb:11]:
--- expected
+++ actual
@@ -1 +1 @@
-#<User id:... >
+nil
Could anyone help make sense of this failure especially the following:
--- expected
+++ actual
@@ -1 +1 @@
Is there any official documentation from rails that gives guidance on those find of failure message? I have not found any. Thanks.
Solution 1:[1]
I do not know this tutorial and I don't know almost nothing of test but I think you have a error in your app. You get a nil output +nil and the expected output is a User element -#<User id:... >
Maybe you have wrong User.where clause
If you put more info I can try help more
Solution 2:[2]
My problem was that I had def current_user twice in app/helpers/sessions_helper.rb and one of them was outdated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | inye |
| Solution 2 | nobody |
