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

Kobi Omenaka
Kobi Omenaka
5,033 Points

I dont understand why this rspec test is failing. Can you help?

I am getting the following error whilst performing the tests in rspec/capybara.

1 example, 1 failure

Failed examples:

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

The following is the code that i'm trying to run.

Can anyone help me?

require 'spec_helper'

describe "Editing todo lists" do
    it "updates a todo list with the correct stuff" do

        todo_list = TodoList.create(title: "Groceries", description: "Grocery list")

        visit "/todo_lists"
        within "#todo_list_#{todo_list.id}" do
            click_link "Edit"
        end 

        fill_in "Title", with: "This is a new title"
        fill_in "Description", with: "New description"
        click_button "Update Todo List"

        todo_list.reload

        expect(page).to have_content("Todo list was successfully updated.")
        expect(todo_list.title).to eq("This is a new title")
        expect(todo_list.description). to eq("New description")
    end 

end
Kobi Omenaka
Kobi Omenaka
5,033 Points

It's ok I found the error.

The click_button "Update Todo List" should have had a lowercase "l" for the word list. so

The click_button "Update Todo list"

I was looking for an error on line 4

Thanks anyway and I hope that this helps other people.