Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAna Takakuwa
2,640 PointsRan the first test and get a 1 failure even though the test runs fine on the local server. Redirecting to the index page
- File was created
require 'spec_helper'
describe "Creating todo lists" do
it "redirects to the todo list index page on success" do
visit "/todo_lists"
click_link "New Todo list"
expect(page).to have_content("New todo_list")
end
end
- If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
config.raise_errors_for_deprecations!
, and it will turn the deprecation warnings into errors, giving you the full backtrace.
2 deprecation warnings total
Finished in 0.271 seconds 1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_lists/create_spec.rb:5 # Creating todo lists redirects to the todo list index page on success
Randomized with seed 9925
2 Answers
Daniel Cunningham
21,109 PointsWhat is the rest of the error? Is it "Expected to have content 'New todo_list'"? or is it something about not being able to find the link "New Todo list". Bear in mind that these commands are case sensitive, so if you mislabel "New Todo list" or needed a capital letter in ('New todo_list'), it will fail.
Ben Michel
3,170 PointsIf it's a syntax error due to a mislabeling like Daniel mentioned, you should have a failure logged similar to this:
Failures:
1) Creating todo lists redirects to the todo list index page on success
Failure/Error: expect(page).to have_content("New todo_list")
expected to find text "New todo_list" in "New Todo List Title Description Back"
# ./spec/features/todo_lists/create_spec.rb:7:in `block (2 levels) in <top (required)>'
I had this problem while following along with the video because I labeled the page content (which is the header) "New Todo List" rather than "New todo_list" like they did.
If this is your case, back in create_spec.rb try changing the line:
expect(page).to have_content("New todo_list")
βTo exactly what you labeled the text that's rendered as the header on the /todo_lists/new page (http://localhost:3000/todo_lists/new).
In my case, I labeled it "New Todo List"βso adjusting accordingly fixed the problem:
expect(page).to have_content("New Todo List")