Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,016 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,392 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,016 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