Следвайки (невероятно) урока за Ruby on Rails на Майкъл Хартл, на последен раздел, получавам следните грешки:
1) User micropost associations status feed should include the microposts of followed users
Failure/Error: @user.feed.should include(mp3)
expected [#<Micropost id: 2, content: "Foo bar", user_id: 1, created_at: "2011-01-12 21:22:41", updated_at: "2011-01-12 22:22:41">, #<Micropost id: 1, content: "Foo bar", user_id: 1, created_at: "2011-01-11 22:22:41", updated_at: "2011-01-12 22:22:41">] to include #<Micropost id: 3, content: "Foo bar", user_id: 2, created_at: "2011-01-12 22:22:41", updated_at: "2011-01-12 22:22:41">
Diff:
@@ -1,2 +1,2 @@
-#<Micropost id: 3, content: "Foo bar", user_id: 2, created_at: "2011-01-12 22:22:41", updated_at: "2011-01-12 22:22:41">
+[#<Micropost id: 2, content: "Foo bar", user_id: 1, created_at: "2011-01-12 21:22:41", updated_at: "2011-01-12 22:22:41">, #<Micropost id: 1, content: "Foo bar", user_id: 1, created_at: "2011-01-11 22:22:41", updated_at: "2011-01-12 22:22:41">]
# ./spec/models/user_spec.rb:214
2) Micropost from_users_followed_by should include the followed user's microposts
Failure/Error: Micropost.from_users_followed_by(@user).should include(@other_post)
expected [#<Micropost id: 1, content: "foo", user_id: 1, created_at: "2011-01-12 22:22:46", updated_at: "2011-01-12 22:22:46">] to include #<Micropost id: 2, content: "bar", user_id: 2, created_at: "2011-01-12 22:22:46", updated_at: "2011-01-12 22:22:46">
Diff:
@@ -1,2 +1,2 @@
-#<Micropost id: 2, content: "bar", user_id: 2, created_at: "2011-01-12 22:22:46", updated_at: "2011-01-12 22:22:46">
+[#<Micropost id: 1, content: "foo", user_id: 1, created_at: "2011-01-12 22:22:46", updated_at: "2011-01-12 22:22:46">]
# ./spec/models/micropost_spec.rb:75
Finished in 9.18 seconds
153 examples, 2 failures
Изглежда, че mp3
не е включен в емисията. Някакви идеи как да го поправя? Или къде да търся евентуални грешки в кода? Сравних файловете с оригиналния код на Hartl; изглежда точно.
Благодаря.