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 Deleting Todo Lists

Greg Kaleka
Greg Kaleka
39,021 Points

bin/rake spec tests are failing

When running the full spec tests at around 2:30 in this video, Jason's tests all pass, but I have four that fail. Failure message is as shown below:

Failed examples:

rspec ./spec/views/todo_lists/index.html.erb_spec.rb:17 # todo_lists/index renders a list of todo_lists
rspec ./spec/views/todo_lists/show.html.erb_spec.rb:11 # todo_lists/show renders attributes in <p>
rspec ./spec/views/todo_lists/edit.html.erb_spec.rb:11 # todo_lists/edit renders the edit todo_list form
rspec ./spec/views/todo_lists/new.html.erb_spec.rb:11 # todo_lists/new renders new todo_list form

I've gone into those individual files, but I cannot figure out what the problem is.

1 Answer

Seth Kroger
Seth Kroger
56,414 Points

Which files? If you scroll further back in the test results you should see a log of what was expected and what you actually got in each failure. Use those as a guide to fix your app code to give the expected values.

Greg Kaleka
Greg Kaleka
39,021 Points

Thanks Seth,

The files are shown in the lines I pasted in, but scrolling up did show me the errors. The problem is with this line in the tests generated by scaffolding the model:

@todo_list = assign(:todo_list, stub_model(TodoList,
  :title => "Title",
  :description => "MyText"
))

Which is getting the error undefined method 'stub_model'. It looks like a version issue. This SO answer points out that stub_model was dropped in rspec 3.0.0. I am using an older version of rails to follow along with this course - I suppose I should use a matching version of rspec as well.

Thanks for your help!

Cheers :beers:

-Greg