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 Viewing Todo Items: Part 1

Master Mind
Master Mind
4,826 Points

I'm getting a syntax error with the identical code.

1) Viewing todo items displays no items when a todo list is empty
     Failure/Error: let!(:todo_list) { TodoList.create(title: "Groceries", description: "Grocery list.") }
     SyntaxError:
       /Users/Projects/odot/app/models/todo_list.rb:9: syntax error, unexpected keyword_end, expecting end-of-input
     # ./spec/features/todo_items/index_spec.rb:4:in `block (2 levels) in <top (required)>'
require 'spec_helper'

describe "Viewing todo items" do
    let!(:todo_list) { TodoList.create(title: "Groceries", description: "Grocery list") }

    it "displays no items when a todo list is empty" do
        visit "/todo_lists"
        within "#todo_list_#{todo_list.id}" do
            click_link "List Items"
        end
        expect(page).to have_content("TodoItems#index")
    end
end

Can you post what's in app/models/todo_list.rb, looks like there's a syntax error around line 9.

Daniel Cunningham
Daniel Cunningham
21,109 Points

/Users/Projects/odot/app/models/todo_list.rb:9: syntax error, unexpected keyword_end, expecting end-of-input

Show us the code in that file.

We are only seeing the code in "/spec/features/todo_items/index_spec.rb:4"

Master Mind
Master Mind
4,826 Points
cclclass TodoList < ActiveRecord::Base
  has_many :todo_items

  validates :title, presence: true
  validates :title, length: { minimum: 3 }

  validates :description, presence: true
  validates :description, length: { minimum: 5 }
end

1 Answer

Master Mind
Master Mind
4,826 Points

I fixed it, I had 'class' misspelled. Thanks you guys just showed me what to look for in an error message.