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 Write Our First Tests

Syntax Error at the last part.

Hi, I've been following along ok, until now. At the last hurdle, my code fails with the following syntax error:

" syntax error, unexpected tIDENTIFIER, expecting ')' (SyntaxError) expect('TodoList.count').to eq(0) ^ "

Any ideas? Thanks,

4 Answers

This:

expect(page.to have_content("error")

needs to be

expect(page).to have_content("error")

You just missed a bracket, I think.

Let me know how you get on.

Steve.

Comment added in your code above ...

Hi Kairos,

Post the whole error and the code in the file it points to. There's just a bracket, or something missing ...

Steve.

Here's my code:

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")

        fill_in "Title", with: "My todo list"
        fill_in "Description", with: "This is what I'm doing today."
        click_button "Create Todo list"

        expect(page).to have_content("My todo list")
    end

    it "displays an error when the todo list has no title" do
        expect(TodoList.count).to eq(0)

        visit "/todo_lists"
        click_link "New Todo list"
        expect(page).to have_content("New Todo List")

        fill_in "Title", with: "My todo list"
        fill_in "Description", with: "This is what I'm doing today."
        click_button "Create Todo list"

        expect(page.to have_content("error")  ## missing bracket here!
            expect(TodoList.count).to eq(0)

        visit "/todo_lists"
        expect(page).to_not have_content("This is what I'm doing today.")
    end
end

Thanks

That solved it, thanks!

:+1: