# Rspec Testing issues -- Beginner Coder and not sure where to start in troubleshooting this

**URL:** <https://www.ruby-forum.com/t/rspec-testing-issues-beginner-coder-and-not-sure-where-to-start-in-troubleshooting-this/234691>\
**Category:** Rails\
**Created:** [March 22, 2015, 7:03pm UTC](https://www.ruby-forum.com/t/rspec-testing-issues-beginner-coder-and-not-sure-where-to-start-in-troubleshooting-this/234691 "2015-03-22T19:03:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 22, 2015, 7:03pm UTC](https://www.ruby-forum.com/t/rspec-testing-issues-beginner-coder-and-not-sure-where-to-start-in-troubleshooting-this/234691/1 "2015-03-22T19:03:33Z")

</div>

Im a noob to ROR and programming in general. i know enough to be  
dangerous  
but not enough to figure out where the hell i’m going wrong here. so  
this  
is what ive done so far.

- wrote test:
- tried to run test to enter text into 2 string fields (see below for  
errors)

thanks for your help with this!

Testing with Rspec and Capybara

\*Testing Code used to run: \*

require ‘spec\_helper’

describe “Create User lists” do  
it “redirects to the users list index page on success” do  
visit “/users”  
click\_link “New User”  
expect(page).to have\_content(“New User”)

```
    fill_in "First_Name", with: "Shawn"
    fill_in "Last_Name", with: "Wilson"
    click_button "Create User"

    expect(page).to have_content("Shawn")
    end
end

```

\*error returned to console when run: \*

_Shawns-MacBook-Pro:SafeReporAPP TaurenLTD1$ bin/rspec  
spec/features/users/create\_spec.rbFFailures: 1) Create User lists  
redirects to the users list index page on success Failure/Error:  
fill\_in “First\_Name”, with: “Shawn” Capybara::ElementNotFound:  
Unable to find field “First\_Name” #  
./spec/features/users/create\_spec.rb:9:in `block (2 levels) in <top (required)>'Deprecation Warnings:--------------------------------------------------------------------------------RSpec::Core::ExampleGroup#example is deprecated and will be removedin RSpec 3. There are a few options for what you can use instead: - rspec-core's DSL methods (`it`,`before`,`after`,`let`,`subject`, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts. - The current example is now exposed via`RSpec.current\_example`, which is accessible from any context. - If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3: RSpec.configure do |c| c.expose_current_running_example_as :example end(Called from /Users/TaurenLTD1/.rvm/gems/ruby-2.2.0/gems/capybara-2.1.0/lib/capybara/rspec.rb:20:in`block (2 levels) in \<top  
(required)\>’)----------------------------------------------------------------------------------------------------------------------------------------------------------------RSpec::Core::ExampleGroup#example  
is deprecated and will be removedin RSpec 3. There are a few options for  
what you can use instead: - rspec-core’s DSL methods (`it`, `before`,  
 `after`, `let`, `subject`, etc) now yield the example as a block  
argument, and that is the recommended way to access the current  
example  
from those contexts. - The current example is now exposed via  
 `RSpec.current_example`, which is accessible from any context. - If  
you  
can’t update the code at this call site (e.g. because it is in an  
extension gem), you can use this snippet to continue making this  
method  
available in RSpec 2.99 and RSpec 3: RSpec.configure do |c|  
c.expose\_current\_running\_example\_as :example end(Called from  
/Users/TaurenLTD1/.rvm/gems/ruby-2.2.0/gems/capybara-2.1.0/lib/capybara/rspec.rb:21:in  
 `block (2 levels) in <top (required)>')--------------------------------------------------------------------------------If you need more of the backtrace for any of these deprecations toidentify where to make the necessary changes, you can configure`config.raise\_errors\_for\_deprecations!`, and it will turn  
thedeprecation warnings into errors, giving you the full backtrace.2  
deprecation warnings totalFinished in 0.06536 seconds1 example, 1  
failureFailed examples:rspec ./spec/features/users/create\_spec.rb:4 #  
Create User lists redirects to the users list index page on  
successRandomized with seed 27327_

---

<div class="post-metadata">

**Author:** ![shawn\_2008](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/df788c/32.png) [@shawn\_2008](https://www.ruby-forum.com/u/shawn_2008)\
**Post date:** [March 22, 2015, 9:37pm UTC](https://www.ruby-forum.com/t/rspec-testing-issues-beginner-coder-and-not-sure-where-to-start-in-troubleshooting-this/234691/2 "2015-03-22T21:37:20Z")

</div>

On Sun, Mar 22, 2015 at 9:41 AM, Shawn W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 1. Create User lists redirects to the users list index page on success  
> Failure/Error: fill\_in “First\_Name”, with: “Shawn”  
> Capybara::ElementNotFound:  
> Unable to find field “First\_Name”

The message seems pretty straightforward: are you absolutely sure  
that “First\_Name” is a label on the page? I would normally expect  
human-readable text like e.g. “First name”.

–  
Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan  
Consulting Availability : Silicon Valley or remote

---

<div class="post-metadata">

**Author:** ![shawn\_2008](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/df788c/32.png) [@shawn\_2008](https://www.ruby-forum.com/u/shawn_2008)\
**Post date:** [March 23, 2015, 6:01pm UTC](https://www.ruby-forum.com/t/rspec-testing-issues-beginner-coder-and-not-sure-where-to-start-in-troubleshooting-this/234691/3 "2015-03-23T18:01:39Z")

</div>

Can you passte your html/view code???

---

<div class="post-metadata">

**Author:** ![shawn\_2008](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/df788c/32.png) [@shawn\_2008](https://www.ruby-forum.com/u/shawn_2008)\
**Post date:** [March 24, 2015, 3:30pm UTC](https://www.ruby-forum.com/t/rspec-testing-issues-beginner-coder-and-not-sure-where-to-start-in-troubleshooting-this/234691/4 "2015-03-24T15:30:30Z")

</div>

Hassan is correct. I would check the value used in the name property of  
the  
field. First\_Name is not the same as first\_name.
