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

bin/rake spec: 4 failures

This is what I get after running bin/rake spec:

Failures:

  1) todo_lists/show renders attributes in <p>
     Failure/Error: @todo_list = assign(:todo_list, stub_model(TodoList,
       `stub_model` is deprecated. Use the `rspec-activemodel-mocks` gem instead. Called from /home/treehouse/projects/odot/spec/views/todo_lists/show.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>'.
     # ./spec/views/todo_lists/show.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>'

  2) todo_lists/index renders a list of todo_lists
     Failure/Error: stub_model(TodoList,
       `stub_model` is deprecated. Use the `rspec-activemodel-mocks` gem instead. Called from /home/treehouse/projects/odot/spec/views/todo_lists/index.html.erb_spec.rb:6:in `block (2 levels) in <top (required)>'.
     # ./spec/views/todo_lists/index.html.erb_spec.rb:6:in `block (2 levels) in <top (required)>'

  3) todo_lists/edit renders the edit todo_list form
     Failure/Error: @todo_list = assign(:todo_list, stub_model(TodoList,
       `stub_model` is deprecated. Use the `rspec-activemodel-mocks` gem instead. Called from /home/treehouse/projects/odot/spec/views/todo_lists/edit.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>'.
     # ./spec/views/todo_lists/edit.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>'

  4) todo_lists/new renders new todo_list form
     Failure/Error: assign(:todo_list, stub_model(TodoList,
       `stub_model` is deprecated. Use the `rspec-activemodel-mocks` gem instead. Called from /home/treehouse/projects/odot/spec/views/todo_lists/new.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>'.
     # ./spec/views/todo_lists/new.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>'

4 deprecations found.

Finished in 18.34 seconds
41 examples, 4 failures, 2 pending

Failed examples:

rspec ./spec/views/todo_lists/show.html.erb_spec.rb:11 # todo_lists/show renders attributes in <p>
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/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

Randomized with seed 35937

/home/treehouse/.rbenv/versions/2.0.0-p353/bin/ruby -S rspec ./spec/controllers/todo_lists_controller_spec.rb ./spec/features/todo_lists/create_spec.rb ./spec/features/todo_lists/destroy_spec.rb ./spec/features/todo_lists/edit_spec.rb ./spec/helpers/todo_lists_helper_spec.rb ./spec/models/todo_list_spec.rb ./spec/requests/todo_lists_spec.rb ./spec/routing/todo_lists_routing_spec.rb ./spec/views/todo_lists/edit.html.erb_spec.rb ./spec/views/todo_lists/index.html.erb_spec.rb ./spec/views/todo_lists/new.html.erb_spec.rb ./spec/views/todo_lists/show.html.erb_spec.rb failed

I really don't know how to proceed from here. I would like to fix this 4 issues without having to update any gems, if possible.

Thank you.

1 Answer

Hi Gus, I believe that as long as the gem you are using (stub_model) is deprecated, you cannot use it's methods in your test code. Have you tried switching to rspec-activemodel-mocks? I believe you will have to switch to it for your tests to work.