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

Maksim Kazlouski
Maksim Kazlouski
8,986 Points

"bin/rake spec" not going through

"bin/rake spec" - command throughs a bunch of errors.

/Users/kmaksim/.rbenv/versions/2.1.4/bin/ruby -I/Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib:/Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/**{,/*/**}/*_spec.rb .......F......................F.F*.....*F

Pending: TodoListsHelper add some examples to (or delete) /Users/kmaksim/Dropbox/WebWorkshop/odot/spec/helpers/todo_lists_helper_spec.rb # Not yet implemented # ./spec/helpers/todo_lists_helper_spec.rb:14 TodoList add some examples to (or delete) /Users/kmaksim/Dropbox/WebWorkshop/odot/spec/models/todo_list_spec.rb # Not yet implemented # ./spec/models/todo_list_spec.rb:4

Failures:

1) todo_lists/new renders new todo_list form Failure/Error: assign(:todo_list, stub_model(TodoList, NoMethodError: undefined method stub_model' for #<RSpec::ExampleGroups::TodoListsNew:0x007faf57da0030> # ./spec/views/todo_lists/new.html.erb_spec.rb:5:inblock (2 levels) in <top (required)>'

2) todo_lists/index renders a list of todo_lists Failure/Error: stub_model(TodoList, NoMethodError: undefined method stub_model' for #<RSpec::ExampleGroups::TodoListsIndex:0x007faf57d4b648> # ./spec/views/todo_lists/index.html.erb_spec.rb:6:inblock (2 levels) in <top (required)>'

3) todo_lists/show renders attributes in <p> Failure/Error: @todo_list = assign(:todo_list, stub_model(TodoList, NoMethodError: undefined method stub_model' for #<RSpec::ExampleGroups::TodoListsShow:0x007faf59918dd0> # ./spec/views/todo_lists/show.html.erb_spec.rb:5:inblock (2 levels) in <top (required)>'

4) todo_lists/edit renders the edit todo_list form Failure/Error: @todo_list = assign(:todo_list, stub_model(TodoList, NoMethodError: undefined method stub_model' for #<RSpec::ExampleGroups::TodoListsEdit:0x007faf57f9be98> # ./spec/views/todo_lists/edit.html.erb_spec.rb:5:inblock (2 levels) in <top (required)>'

Deprecation Warnings:

Using any_instance from rspec-mocks' old :should syntax without explicitly enabling the syntax is deprecated. Use the new :expect syntax or explicitly enable :should instead. Called from /Users/kmaksim/Dropbox/WebWorkshop/odot/spec/controllers/todo_lists_controller_spec.rb:87:in `block (4 levels) in <top (required)>'.

Using should from rspec-expectations' old :should syntax without explicitly enabling the syntax is deprecated. Use the new :expect syntax or explicitly enable :should instead. Called from /Users/kmaksim/Dropbox/WebWorkshop/odot/spec/routing/todo_lists_routing_spec.rb:23:in `block (3 levels) in <top (required)>'.

If you need more of the backtrace for any of these deprecations to identify where to make the necessary changes, you can configure config.raise_errors_for_deprecations!, and it will turn the deprecation warnings into errors, giving you the full backtrace.

2 deprecation warnings total

Finished in 0.71845 seconds (files took 3.26 seconds to load) 41 examples, 4 failures, 2 pending

Failed examples:

rspec ./spec/views/todo_lists/new.html.erb_spec.rb:11 # todo_lists/new renders new todo_list form 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

Randomized with seed 14203

I'm not sure where to look to fix them. Can you help me out please? Thanks.

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

That depends how confident you feel with Rails. I myself decided to use new versions of gems and 'translate' what is done in the videos into new methods and ways of doing stuff. I don't know what is best for you. If you want to follow the videos line-by-line, you have to downgrade the gems or simply download the code from the videos and work on it from now on. Downgrading rspec from 3 to 2 is not that easy. It's not just changing one line in the Gemfile and running bundle. You'd have to look through a lot of documentation to understand what's different and what needs to change.

Maksim Kazlouski
Maksim Kazlouski
8,986 Points

Thanks, i'll download code of project from treehouse. Thats probably the best way to do it for me.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

You are using Rspec version 3, the videos use RSpec 2, so some stuff will not work at all and some stuff will look different. stub_model is gone in RSpec 3:

http://stackoverflow.com/questions/24059805/rspec-view-undefined-method-stub-model

Maksim Kazlouski
Maksim Kazlouski
8,986 Points

What is best thing to do right know? Change in gemfile of "ODOT" project version Rspec to less than 3 and run bundle?

Now i'm watching "Relationship video" and some code that is being generated by framework doesn't match with one shown in the video. Confused about what to do.

Maksim Kazlouski
Maksim Kazlouski
8,986 Points

Added "rspec-activemodel-mocks" gem less errors but still

/Users/kmaksim/.rbenv/versions/2.1.4/bin/ruby -I/Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib:/Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/**{,/*/**}/*_spec.rb /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require': cannot load such file -- rails_helper (LoadError) from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inblock in require' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inrequire' from /Users/kmaksim/Dropbox/WebWorkshop/odot/spec/models/todo_item_spec.rb:1:in <top (required)>' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:inload' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in block in load' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:inload_dependency' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in load' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:inblock in load_spec_files' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in each' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:inload_spec_files' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96:in setup' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:inrun' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in run' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:ininvoke' from /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec:4:in `<main>' /Users/kmaksim/.rbenv/versions/2.1.4/bin/ruby -I/Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib:/Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib /Users/kmaksim/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/**{,/*/**}/*_spec.rb failed