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,007 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,369 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,007 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: