I am using Ruby on Rails Tutorial by Michael Hartl - Chapter 8 - Rails 3
In the file new.html.erb I have:
<h1>Sign up</h1>
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages' %>
I created the file app/views/shared/_error_messages.html.erb
When I run the test: bundle exec rspec spec/requests/users_spec.rb I get the following error messages:
Failures:
Users signup failure should not make a new user
Failure/Error: visit signup_path ActionView::Template::Error: Missing partial shared/error_messages with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/username/rails_开发者_StackOverflow中文版projects/my_sample_app/app/views"
Users signup success should make a new user
Failure/Error: visit signup_path ActionView::Template::Error: Missing partial shared/error_messages with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/username/rails_projects/my_sample_app/app/views"
Thanks apneadiving. When I went to the folder app/views/shared and did an ls command it showed the file there. However, when I tried to cat the file it returned file not found. Doing an ls -al showed the file had a @ for extra attributes. I loaded the file in my editor and saved it under another name. Then recreated the original file and removed the old file. Everything worked then.
精彩评论