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 trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Editing Todo Lists

Sophia He
Sophia He
2,554 Points

HELP!Keep getting this error message!

I follow the exact code from the video, but I keep getting an error message saying there's something wrong about the rb4.

require 'spec_helper'

describe "Editing todo lists" do 
    it "updates a todo list successfully with correct information" do
        todo_list = TodoList.create(title: "Groceries", description: "Grocery list.")

        visit "/todo_lists"
        within "#{todo_list{todo_list.id}}" do

        fill_in "Title", with: "New title"
        fill_in "Description", with: "New description"
        click_button "Update Todo list"


        expect(page).to have_content("Todo list was successfully updated.")
        expect(todo_list.title).to eq("New title")
        expect(todo_list.description).to eq("New description")
Sophia He
Sophia He
2,554 Points

and my error message is

2 deprecation warnings total

Finished in 0.33704 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/features/todo_lists/edit_spec.rb:4 # Editing todo lists updates a todo list succesfully with correct info

Randomized with seed 39811

2 Answers

Seth Kroger
Seth Kroger
56,412 Points

It means that the test failed, ie. the code for editing the todo_lists isn't doing what the test "expects" it to do. Often it's a mistake in the the code you're testing (or you haven't written the code to do what you're testing yet). Sometimes it's a mistake in the test.

First make sure there's a space between click_link and "Edit" and run the test again. If the test still fails then look to the editing code and views in app/

Nathan F.
Nathan F.
30,773 Points

How is your index.html.erb file formatted? What id does it output on elements on the page?

Your test may be failing because Jason told us to make an ID of "todo_list_#{domid}", but your test looks for #todo_list(id) (todo_list1, todo_list2, ...etc). Double-check your HTML markup to make sure it matches what you're looking for in your test. The specific cause of this failure, like expecting a different result, or not being able to find the CSS selector, should be above those lines you copied.