At about the 12.5 minute mark into the 3rd “lesson” on unit testing, we are told to run specs for the manage_todos_spec.rb and that they should be working.
This is right after changing this code on line 14. below. Strangely, I’m getting an odd error when I run the tests for manage_todos_spec.rb. I’ve compared my code to others who are slightly further along and can’t find what is different.
Any ideas?
Phil
|~ 1 class TodosController < ApplicationController 2 3 def index 4 #@todos = Todo.all 5 @todos = current_user.todos 6 end 7 8 def new 9 @todo = Todo.new 10 end 11 12 def create 13 @todo = Todo.new(params[:todo]) 14 @todo.user = current_user 15 @todo.save 16 redirect_to todos_path 17 18 end 19 20 end
TEST OUTPUT
Manage todos create a new todo
Failure/Error: sign_in
ActionView::Template::Error:
SQLite3::SQLException: no such column: owner_email.current_email: SELECT “todos”.* FROM “todos” WHERE
“owner_email”.“current_email” = ‘person@example.com’ AND
“owner_email”.“todos” IN (NULL)./app/views/todos/index.html.haml:2:in `_app_views_todos_index_html_haml__2802188835747511554_70281750326360’
(eval):2:in `click_button’
./spec/support/sign_in_helpers.rb:10:in `sign_in_as’
./spec/support/sign_in_helpers.rb:4:in `sign_in’
./spec/integration/manage_todos_spec.rb:5:in `block (2 levels) in <top (required)>’
Manage todos view only my todos
Failure/Error: sign_in_as ‘me@example.com’
ActionView::Template::Error:
SQLite3::SQLException: no such column: owner_email.current_email: SELECT “todos”.* FROM “todos” WHERE
“owner_email”.“current_email” = ‘me@example.com’ AND
“owner_email”.“todos” IN (1)./app/views/todos/index.html.haml:2:in `_app_views_todos_index_html_haml__2802188835747511554_70281750326360’
(eval):2:in `click_button’
./spec/support/sign_in_helpers.rb:10:in `sign_in_as’
./spec/integration/manage_todos_spec.rb:15:in `block (2 levels) in <top (required)>’
Finished in 0.24281 seconds 2 examples, 2 failures
Failed examples:
rspec ./spec/integration/manage_todos_spec.rb:4 # Manage todos create
a new todo rspec ./spec/integration/manage_todos_spec.rb:13 # Manage
todos view only my todosRandomized with seed 48209