← Back to Upcase

Can not find Email address


(Charlieanna) #1

Why do I get this?

Failure/Error: fill_in "Email address",with: "person@example.com"
     Capybara::ElementNotFound:
       cannot fill in, no text field, text area or password field with id, name, or label 'Email address' found

even though I have this

<%= form_for :session,url: session_path do |f|%>
  <%= f.label :email_address %>
  <%= f.text_field "email_address "%>
  <%= f.submit "Sign In"%>
<% end %>

require ‘spec_helper’

feature "Sign in as a user" do
  scenario "with an email address" do
    visit root_path
    fill_in "Email address",with: "person@example.com"
    click_button "Sign In"
    expect(page).to have_css ".welcome",text: "Signed in as person@example.com"
  end
end

(Charlieanna) #2

Oh I get it.

I had to change the line to

<%= f.text_field :email_address %>