0
Finished in 15.53 seconds
←[31m86 examples, 4 failures←[0m

失败的例子:

←[31mrspec ./spec/requests/user_pages_spec.rb:95←[0m ←[36m# User pages signup wi
th valid information should create a user←[0m
←[31mrspec ./spec/requests/user_pages_spec.rb:104←[0m ←[36m# User pages signup w
ith valid information after saving the user ←[0m
←[31mrspec ./spec/requests/user_pages_spec.rb:105←[0m ←[36m# User pages signup w
ith valid information after saving the user ←[0m
←[31mrspec ./spec/requests/user_pages_spec.rb:106←[0m ←[36m# User pages signup w
ith valid information after saving the user ←[0m

不明白为什么我会收到此错误。我按照红宝石指南中的说明,问题 5 .. http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users?version=3.2#sec:updating_deleting_exercises

应用程序/视图/用户/new.html.erb

<%= provide(:title, 'Sign up') %>
<h1>Sign up</h1>

<div class="row">
<div class="span6 offset3">
<%= form_for(@user) do |f| %>
<%= render 'fields', f: f %>
<%= f.submit "Create my account", class: "btn btn-large btn-primary" %>
<% end %>
</div>
</div>

应用程序/视图/用户/edit.html.erb

<%= provide(:title, 'Edit user') %>
<h1>Update your profile</h1>

<div class="row">
<div class="span6 offset3">
<%= form_for(@user) do |f| %>
<%= render 'fields', f: f %>
<%= f.submit "Save changes", class: "btn btn-large btn-primary" %>
<% end %>

<%= gravatar_for @user %>
<%= link_to "change", "http://gravatar.com/emails", :target => "_new"%>

</div>
</div>

应用程序/视图/用户/_fields.html.erb

<%= render 'shared/error_messages' %>

<%= f.label :name %>
<%= f.text_field :name %>

<%= f.label :email %>
<%= f.text_field :email %>

<%= f.label :password %>
<%= f.password_field :password %>

<%= f.label :password_confirmation, "Confirm Password" %>
<%= f.password_field :password_confirmation %>

当我不尝试解决重构此代码并使其重复时,我没有收到任何错误..所以我在想/spec/requests/user_pages_spec.rb并没有真正的问题..任何建议将不胜感激.

这很奇怪,因为该应用程序似乎没有任何问题(或者它似乎没有任何问题),但是它工作得非常好......它只是那个让我烦恼的错误。

-马克

4

0 回答 0