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 Cleaning Up Our View

Brian Patterson
Brian Patterson
19,588 Points

Please help!!!!

I was with him half way through the tape. Now I am getting this error message. I don't know where I have gone wrong.

Failures:

  1) Completing todo items is successful when marking a single item complete
     Failure/Error: visit_todo_list todo_list
     ActionView::Template::Error:
       undefined method `completed?' for #<TodoItem:0xb948a170>
     # ./app/views/todo_items/index.html.erb:16:in `block in _app_views_todo_items_index_html_erb___189114904__593224538'
     # ./app/views/todo_items/index.html.erb:13:in `_app_views_todo_items_index_html_erb___189114904__593224538'
     # ./spec/support/todo_list_helpers.rb:5:in `block in visit_todo_list'
     # ./spec/support/todo_list_helpers.rb:4:in `visit_todo_list'
     # ./spec/features/todo_items/complete_spec.rb:9:in `block (2 levels) in <top (required)>'

  2) Completing todo items with completed items shows completed items as complete
     Failure/Error: visit_todo_list todo_list
     ActionView::Template::Error:
       undefined method `completed?' for #<TodoItem:0xb9724e6c>
     # ./app/views/todo_items/index.html.erb:16:in `block in _app_views_todo_items_index_html_erb___189114904__593224538'
     # ./app/views/todo_items/index.html.erb:13:in `_app_views_todo_items_index_html_erb___189114904__593224538'
     # ./spec/support/todo_list_helpers.rb:5:in `block in visit_todo_list'
     # ./spec/support/todo_list_helpers.rb:4:in `visit_todo_list'
     # ./spec/features/todo_items/complete_spec.rb:21:in `block (3 levels) in <top (required)>'

  3) Completing todo items with completed items does not give the option to mark complete
     Failure/Error: visit_todo_list todo_list
     ActionView::Template::Error:
       undefined method `completed?' for #<TodoItem:0xb97532d0>
     # ./app/views/todo_items/index.html.erb:16:in `block in _app_views_todo_items_index_html_erb___189114904__593224538'
     # ./app/views/todo_items/index.html.erb:13:in `_app_views_todo_items_index_html_erb___189114904__593224538'
     # ./spec/support/todo_list_helpers.rb:5:in `block in visit_todo_list'
     # ./spec/support/todo_list_helpers.rb:4:in `visit_todo_list'
     # ./spec/features/todo_items/complete_spec.rb:28:in `block (3 levels) in <top (required)>'

Deprecation Warnings:

--------------------------------------------------------------------------------
RSpec::Core::ExampleGroup#example is deprecated and will be removed
in RSpec 3. There are a few options for what you can use instead:

  - rspec-core's DSL methods (`it`, `before`, `after`, `let`, `subject`, etc)
    now yield the example as a block argument, and that is the recommended
    way to access the current example from those contexts.
  - The current example is now exposed via `RSpec.current_example`,
    which is accessible from any context.
  - If you can't update the code at this call site (e.g. because it is in
    an extension gem), you can use this snippet to continue making this
    method available in RSpec 2.99 and RSpec 3:

      RSpec.configure do |c|
        c.expose_current_running_example_as :example
      end

(Called from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rspec.rb:20:in `block (2 levels) in <top (required)>')
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
RSpec::Core::ExampleGroup#example is deprecated and will be removed
in RSpec 3. There are a few options for what you can use instead:

  - rspec-core's DSL methods (`it`, `before`, `after`, `let`, `subject`, etc)
    now yield the example as a block argument, and that is the recommended
    way to access the current example from those contexts.
  - The current example is now exposed via `RSpec.current_example`,
    which is accessible from any context.
  - If you can't update the code at this call site (e.g. because it is in
    an extension gem), you can use this snippet to continue making this
    method available in RSpec 2.99 and RSpec 3:

      RSpec.configure do |c|
        c.expose_current_running_example_as :example
      end

(Called from /home/treehouse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rspec.rb:21:in `block (2 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.5004 seconds
3 examples, 3 failures

Failed examples:

rspec ./spec/features/todo_items/complete_spec.rb:7 # Completing todo items is successful when marking a single item complete
rspec ./spec/features/todo_items/complete_spec.rb:20 # Completing todo items with completed items shows completed items as complete
rspec ./spec/features/todo_items/complete_spec.rb:27 # Completing todo items with completed items does not give the option to mark complete

Randomized with seed 63599

You don't need to paste in the deprecation messages, it's just to tell you that you're using an older version of rSpec. Not a problem. The video is a bit old. The error is this:

-> Completing todo items is successful when marking a single item complete Failure/Error: visittodo_list todo_list ActionView::Template::
Error: undefined method completed?' for #<TodoItem:0xb948a170>

-> Completing todo items with completed items shows completed items as complete Failure/Error: visittodo_list todo_list ActionView::Template::
Error: undefined method completed?' for #<TodoItem:0xb9724e6c> 

-> Completing todo items with completed items does not give the option to mark complete Failure/Error: visittodo_list todo_list ActionView::Template::

# A typo in the completed? method perhaps
Error: undefined method completed?' for #<TodoItem:0xb97532d0>

See the error? It's a typo.

1 Answer

I'm guessing from the error messages, that you've made a typo in your completed? method. You might have called it 'completed' without a question mark, or something like that. Try to check that in your code. If you cannot fix it, paste the complete_spec.rb file, and we'll see if something can't be done. Sounds good? Hope this helps.

Brian Patterson
Brian Patterson
19,588 Points

Will have look later. Thanks for the reply as I have been racking my brains about this.