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

John Stoveld
John Stoveld
4,203 Points

1 failed test upon rspec create spec.rb

I get the following error:

2 deprecation warnings total

Finished in 0.07746 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list index page on success

Randomized with seed 59387

When I run:

bin/rspec spec/features/todo_lists/create_spec.rb

while create_spec.rb reads:

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

I was so frustrated I just grabbed jasons code from the zip folder and copied and pasted thinking I missed something and still got the same error.

Makes me feel a little better.

But sadly - just a little better.

5 Answers

What does your apps/views/todo_lists/index.html.erb file look like?

John Stoveld
John Stoveld
4,203 Points

Ended up having a freakout and reverse engineered jasons code.

Fear I am not going to get all this down the first time around.

Hard to work with an outdated video and a newer version of ruby.

John, I'm having the same problem. The syntax is changed. Jason is using Rspec 2 but the most recent is 3.

Treehouse REALLY needs to update their videos.

Josiah Schaefer
Josiah Schaefer
7,489 Points

Yeah this is getting ridiculous. I'm ready to give up on this track.

Justin Black
Justin Black
24,793 Points

You have typos in your code. I'm using the latest ruby, the latest rails, latest everything.

Code should read:

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

end

Capitalization matters. You did what I did, and typed exactly what he did. I then ran through the same steps he did, and I got my passing results.

Hiroshi Kadokura
Hiroshi Kadokura
8,035 Points

Justin's code worked for me, too.

looks like this code below was the key(worked!).

expect(page).to have_content("New Todo List")

the application title in the video was "New Todo_List" There was an under-bar between "Todo" and "List"

but my Odot app, there is no under-bar. Just "New Todo List" I don't know why this happened but when I fix this, it works. Whenever I add an under-bar, test fails...

Mark Stansbury
Mark Stansbury
2,603 Points

I got it to work using :

click_link "New Todo list"  

Note that "list" begins with a lower cap, like the link on the todo_lists page.

expect(page).to have_content("New Todo List")

Note that "List" beings with an upper cap, like the title on the todo_list page.

Why these are different, I do not know.

More importantly, if the classes actually taught us what these lines of code mean or are supposed to do, this wouldn't be such a crap shoot. I'm not sure what the point of these lessons is anymore. We're just watching someone code, without the slightest hint of actual instruction.