Note that there are some explanatory texts on larger screens.

plurals
  1. POHartl Ruby-on-Rails Tutorial (3.2), Section 7.2 - Sign up form missing template
    primarykey
    data
    text
    <p><strong>I'm getting the following error when testing the sign up page for the ruby-on-rails tutorial:</strong></p> <pre><code>Failures: 1) User pages signup with valid information should create a user Failure/Error: expect { click_button submit }.to change(User, :count).by(1) ActionView::MissingTemplate: Missing template users/create, application/create with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :coffee]}. Searched in: * "/Users/Fif/rails_projects/sample_app/app/views" # (eval):2:in `click_button' # ./spec/requests/user_pages_spec.rb:43:in `block (5 levels) in &lt;top (required)&gt;' # ./spec/requests/user_pages_spec.rb:43:in `block (4 levels) in &lt;top (required)&gt;' Finished in 0.76918 seconds 35 examples, 1 failure Failed examples: rspec ./spec/requests/user_pages_spec.rb:42 # User pages signup with valid information should create a user </code></pre> <p><strong>I'm not sure what the problem is, and I've gone over the code several times to make sure that it matches the examples in the book. I'm pretty sure that it has to do with the new.html.erb file</strong> </p> <h1><strong>user_pages_spec.rb</strong></h1> <pre><code>require 'spec_helper' describe "User pages" do subject { page } describe "signup page" do before { visit signup_path } it { should have_selector('h1', text: 'Sign up') } it { should have_selector('title', text: full_title('Sign up')) } end describe "profile page" do let(:user) { FactoryGirl.create(:user) } before { visit user_path(user) } it { should have_selector('h1', text: user.name) } it { should have_selector('title', text: user.name) } end describe "signup" do before { visit signup_path } let(:submit) { "Create my account" } describe "with invalid information" do it "should not create a user" do expect { click_button submit }.not_to change(User, :count) end end describe "with valid information" do before do fill_in "Name", with: "Example User" fill_in "Email", with: "user@example.com" fill_in "Password", with: "foobar" fill_in "Confirmation", with: "foobar" end it "should create a user" do expect { click_button submit }.to change(User, :count).by(1) end end end end </code></pre> <h1>new.html.erb</h1> <pre><code>&lt;%= provide(:title, 'Sign up') %&gt; &lt;h1&gt;Sign up&lt;/h1&gt; &lt;div class="row"&gt; &lt;div class="span6 offset3"&gt; &lt;%= form_for(@user) do |f| %&gt; &lt;%= f.label :name %&gt; &lt;%= f.text_field :name %&gt; &lt;%= f.label :email %&gt; &lt;%= f.text_field :email %&gt; &lt;%= f.label :password %&gt; &lt;%= f.password_field :password %&gt; &lt;%= f.label :password_confirmation, "Confirmation" %&gt; &lt;%= f.password_field :password_confirmation %&gt; &lt;%= f.submit "Create my account", class: "btn btn-large btn-primary" %&gt; &lt;% end %&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <h1>users_controller.rb</h1> <pre><code>class UsersController &lt; ApplicationController def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(params[:user]) if @user.save # Handle a successful save. else render 'new' end end end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload