1

MichaelHartlによるRubyonRailsチュートリアルで問題が発生しています。私は第10章の終わりにいて、大量の失敗したテストを受けています。私は自分のコードをMichaelがまとめたgithubリポジトリと比較しました。失敗したテストレポートは次のとおりです。

  1) Authentication signin with valid information 
     Failure/Error: click_button "Sign in"
     ActionView::Template::Error:
       Missing partial shared/stats with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:
         * "/Users/bobbysudekum/Documents/Projects/rails/Secondattempt/sample_app_three/app/views"
     # ./app/views/users/show.html.erb:11:in `_app_views_users_show_html_erb___2309319721249673303_70162631795520'
     # (eval):2:in `click_button'
     # ./spec/requests/authentication_pages_spec.rb:34:in `block (4 levels) in <top (required)>'

  2) Authentication signin with valid information 
     Failure/Error: click_button "Sign in"
     ActionView::Template::Error:
       Missing partial shared/stats with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:
         * "/Users/bobbysudekum/Documents/Projects/rails/Secondattempt/sample_app_three/app/views"
     # ./app/views/users/show.html.erb:11:in `_app_views_users_show_html_erb___2309319721249673303_70162631795520'
     # (eval):2:in `click_button'
     # ./spec/requests/authentication_pages_spec.rb:34:in `block (4 levels) in <top (required)>'

  3) Authentication signin with valid information 
     Failure/Error: click_button "Sign in"
     ActionView::Template::Error:
       Missing partial shared/stats with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:
         * "/Users/bobbysudekum/Documents/Projects/rails/Secondattempt/sample_app_three/app/views"
     # ./app/views/users/show.html.erb:11:in `_app_views_users_show_html_erb___2309319721249673303_70162631795520'
     # (eval):2:in `click_button'
     # ./spec/requests/authentication_pages_spec.rb:34:in `block (4 levels) in <top (required)>'

     # REMOVED 43 more identical errors

githubから移植されたビュー

<% provide(:title, @user.name) %>
<div class="row">
  <aside class="span4">
    <section>
      <h1>
        <%= gravatar_for @user %>
        <%= @user.name %>
      </h1>
    </section>
    <section>
      <%= render 'shared/stats' %>
    </section>
  </aside>
  <div class="span8">
    <%= render 'follow_form' if signed_in? %>
    <% if @user.microposts.any? %>
      <h3>Microposts (<%= @user.microposts.count %>)</h3>
      <ol class="microposts">
        <%= render @microposts %>
      </ol>
      <%= will_paginate @microposts %>
    <% end %>
  </div>
  </div>
</div>

サンプルコードが含まれていないことをお詫びします-文字数制限を超えました。githubの残りのコードを参照してください-https ://github.com/rsudekum/sample_app_three

Rails / Rubyは初めてなので、失敗したテストで何を探すべきか本当にわかりません。誰かが私を正しい方向に向けることができれば、それは非常に義務的です。

よろしくお願いします。

4

1 に答える 1

1

Please see my pull request: https://github.com/rsudekum/sample_app_three/pull/1

Here are my notes as I cloned the application and investigated the errors. Please note that I started my investigation before the comments to the answer were posted, so I may have noted things you already knew about. Regardless, all specs are now passing on my machine. I tried to make the application resemble the state of the tutorial at the end of chapter 10, but I've never followed this tutorial, so it may not be an exact match.

The first migration, 20120711232738_create_users.rb, seems to have had its entire file content replaced with the content for the 20120714233631_create_microposts.rb. (Accidental copy-paste?) Reverting to its original content resolves the migration issue.

The partial in views/shared/_stats.html.erb was missing. Since you said you had just completed chapter 10, and this partial is not introduced until chapter 11, I decided to comment out the reference to it instead of updating the partial itself, because the partial makes references to things not discussed until chapter 11.

Ditto for the follow_form partial.

The shared/feed and shared/feed_item partials were incorrect based on listing 10.42 and 10.47. I corrected them to reflect those listings.

You forgot to assign object: f.object in your rendering of the error_messages partial from users/edit.html.erb.

You used confirm: "..." in users/_user.html.erb. That's OK but deprecated, so I changed it to data: { confirm: "..." } instead.

Ditto about confirm for microposts/_microposts.html.erb.

You forgot to add the code for SessionsController#destroy. This is covered in listing 8.29. I added it.

于 2012-07-15T18:54:38.267 に答える