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

gerald blady
gerald blady
9,052 Points

At 5:43 won't test, showing weird error message >>

The first test of bin/rspec spec/features/todo_lists/create_spec.rb passes no problem...

BUT when i run bin/rspec spec/features/todo_lists/edit_spec.rb in terminal it seems as if the test isn't running as i'm receiving the following error message.

Jerrys-MacBook-Pro:odot jerryblady$ bin/rspec spec/features/todo_lists/edit_spec.rb
/Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `load': /Users/jerryblady/Source/projects/odot/spec/features/todo_lists/edit_spec.rb:22: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)
    from /Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `block in load_spec_files'
    from /Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `each'
    from /Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `load_spec_files'
    from /Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:103:in `run'
    from /Users/jerryblady/.rvm/gems/ruby-2.1.2/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:17:in `block in autorun'

It looks like it's pointing to edit_spec.rb line 22 which is just the end of the code i'll paste below.

edit_spec.rb
require 'spec_helper'

describe "Editing todo lists" do 
    it "updates a todo list successfully with correct information"
        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: "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("New title")
        expect(todo_list.description).to eq("New description")
    end
end

Any help would be amazing!!

1 Answer

Looks like you're missing a do after your it declaration on line 4.

gerald blady
gerald blady
9,052 Points

Thanks Geoff,

Crazy what another set of eyes does!

I hear ya gerald blady! The syntax errors from an unclosed block are a nightmare sometimes since the best line number it can give you is often the end of the file.