Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Deleting Todo Lists

Matthew Restorff
Matthew Restorff
32,162 Points

Errors on rake spec

All my spec tests succeed, but when I run the final rake spec I get some errors. Not super sure what to do. I tried a few things but it mostly resulted in more errors. Any ideas? Thanks!

/Users/matt/.rvm/rubies/ruby-2.1.5/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
/Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/formatters/deprecation_formatter.rb:187:in `puts': -------------------------------------------------------------------------------- (RSpec::Core::DeprecationError)
    The semantics of `RSpec::Core::ExampleGroup.pending` are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped.     In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how `pending` with a block
from within an example already works.

    To keep the same skip semantics, change `pending` to `skip`.  Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.

Called from     /Users/matt/Projects/ODOT/odot/spec/helpers/todo_lists_helper_spec.rb:14:in `block in <top (required)>'.

--------------------------------------------------------------------------------
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/formatters/deprecation_formatter.rb:124:in `print_deprecation_message'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/formatters/deprecation_formatter.rb:32:in `deprecation'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:130:in `block in notify'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:129:in `each'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:129:in `notify'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:101:in `deprecation'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/deprecation.rb:20:in `warn_deprecation'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:77:in `pending'
from /Users/matt/Projects/ODOT/odot/spec/helpers/todo_lists_helper_spec.rb:14:in `block in <top (required)>'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:369:in `module_eval'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:369:in `subclass'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:342:in `describe'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/dsl.rb:18:in `describe'
from /Users/matt/Projects/ODOT/odot/spec/helpers/todo_lists_helper_spec.rb:13:in `<top (required)>'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `block in load_spec_files'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `each'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `load_spec_files'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/command_line.rb:18:in `run'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:103:in `run'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:17:in `block in autorun'
/Users/matt/.rvm/rubies/ruby-2.1.5/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

My guess is that you have a 'pending' in todo_lists_helper_spec.rb on line 14 and rspec is unhappy with it. Perhaps you could try changing that test to 'skip' or fix the test.

Matthew Restorff
Matthew Restorff
32,162 Points

I commented out that test, it was something that rails put in there by default.

Now I'm getting this error in my index.html.erb file after that:

The semantics of `RSpec::Core::ExampleGroup.pending` are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped. In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how `pending` with a block
from within an example already works.

 To keep the same skip semantics, change `pending` to `skip`.  Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.

Called from /Users/matt/Projects/ODOT/odot/spec/views/todo_items/index.html.erb_spec.rb:4:in `block in <top (required)>'.

--------------------------------------------------------------------------------
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/formatters/deprecation_formatter.rb:124:in `print_deprecation_message'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/formatters/deprecation_formatter.rb:32:in `deprecation'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:130:in `block in notify'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:129:in `each'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:129:in `notify'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/reporter.rb:101:in `deprecation'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/deprecation.rb:20:in `warn_deprecation'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:77:in `pending'
from /Users/matt/Projects/ODOT/odot/spec/views/todo_items/index.html.erb_spec.rb:4:in `block in <top (required)>'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:369:in `module_eval'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:369:in `subclass'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/example_group.rb:342:in `describe'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/dsl.rb:18:in `describe'
from /Users/matt/Projects/ODOT/odot/spec/views/todo_items/index.html.erb_spec.rb:3:in `<top (required)>'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `block in load_spec_files'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `each'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `load_spec_files'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/command_line.rb:18:in `run'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:103:in `run'
from /Users/matt/.rvm/gems/ruby-2.1.5/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:17:in `block in autorun'

Well my line index.html.erb is just this:

<h1><%= @todo_list.title %></h1>

<ul class="todo_items">
<% @todo_list.todo_items.each do |todo_item| %>
<li id="<%= dom_id(todo_item) %>">
    <%= todo_item.content %>
    <%= link_to "Edit", edit_todo_list_todo_item_path(todo_item) %>
    <%= link_to "Delete", todo_list_todo_item_path(todo_item), method: :delete, data: { confirm: "Are you sure?" }  %>
</li>
<% end %>
</ul>

<p><%= link_to "New Todo Item", new_todo_list_todo_item_path %></p>

I'm not sure what the actual error is here.

You seem to be trying to run rspec from inside '../bin/ruby' ?

Try moving to the home directory of your project and try it again.

Matthew Restorff
Matthew Restorff
32,162 Points

Hmm I'm not running that. I'm just using bin/rspec and bin/rake like in the videos. So I'm not sure where that is coming from.