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

Nelly Nelly
Nelly Nelly
7,134 Points

Weird things in my tests

Hi there!

First here is my repo: https://github.com/knopfler81/odot/tree/mark_completed

Why failures aren't the same if I run rspec or rake ?

When I run this: rspec spec/features/todo_items/complete_spec.rb

I have :

$ rspec spec/features/todo_items/complete_spec.rb
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:57)
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:58)

Completing todo items
  is successful when marking a single item complete (FAILED - 1)
  with completed items
    shows completed item as completed
    does not give the option to mark complete

Failures:

  1) Completing todo items is successful when marking a single item complete
     Failure/Error: expect(todo_item.completed_at).to_not be_nil

       expected: not nil
            got: nil
     # ./spec/features/todo_items/complete_spec.rb:16:in `block (2 levels) in <top (required)>'

Finished in 0.69027 seconds (files took 1.49 seconds to load)
3 examples, 1 failure

Failed examples:

rspec ./spec/features/todo_items/complete_spec.rb:9 # Completing todo items is successful when marking a single item complete

if I run : rake

$ rake
/Users/nellyduclos/.rvm/rubies/ruby-2.2.1/bin/ruby -I/Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.1/lib:/Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rspec-support-3.5.0/lib /Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /Users/nellyduclos/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:57)
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /Users/nellyduclos/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:58)

Completing todo items
  is successful when marking a single item complete
  with completed items
    shows completed item as completed
    does not give the option to mark complete

Adding todo items
  is successful with valid content
  display an error with no content
  display an error with content less than 2 charaters long

Deleting todo items
  is successful

Editing todo items
  is successful with valid content
  is unsuccessful with no content
  is unsuccessful with not enough content

Viewing todo items
  displays the title of the todo list
  displays no items when todo list is empty
  displays item content when a todo list has items (FAILED - 1)

Creating todo list
  redirects to the todo list index page on success
  display an error when the todo list has no title
  display an error when the todo list has a title less than 3 characters
  display an error when the todo list has no description
  display an error when the todo list has a description less than 5 characters

Deleting todo list
  is successful when clicking the destroy link

Editing todo list
  updates a todo list successfully with correct information
  display an error with no title
  display an error with no description
  display an error with too short title
  display an error with too short description

TodoItem
  should belong to todo_list

TodoList
  should have many todo_items

TodoListsController
  routing
    routes to #index
    routes to #new
    routes to #show
    routes to #edit
    routes to #create
    routes to #update
    routes to #destroy

Failures:

  1) Viewing todo items displays item content when a todo list has items
     Failure/Error: expect(page.all("table.todo_items td").size).to eq(6)

       expected: 6
            got: 8

       (compared using ==)
     # ./spec/features/todo_items/index_spec.rb:23:in `block (2 levels) in <top (required)>'

Deprecation Warnings:

--------------------------------------------------------------------------------
Shoulda::Matchers::ActiveRecord::AssociationMatcher implements a legacy RSpec matcher
protocol. For the current protocol you should expose the failure messages
via the `failure_message` and `failure_message_when_negated` methods.
(Used from /Users/nellyduclos/Desktop/TeamTreeHouse/odot/spec/models/todo_item_spec.rb:4:in `block (2 levels) in <top (required)>')
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Shoulda::Matchers::ActiveRecord::AssociationMatcher implements a legacy RSpec matcher
protocol. For the current protocol you should expose the failure messages
via the `failure_message` and `failure_message_when_negated` methods.
(Used from /Users/nellyduclos/Desktop/TeamTreeHouse/odot/spec/models/todo_list_spec.rb:4: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.93474 seconds (files took 1.47 seconds to load)
33 examples, 1 failure

Failed examples:

rspec ./spec/features/todo_items/index_spec.rb:17 # Viewing todo items displays item content when a todo list has items

/Users/nelly/.rvm/rubies/ruby-2.2.1/bin/ruby -I/Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.1/lib:/Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rspec-support-3.5.0/lib /Users/nelly/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

thanks for your help :)