My test coverage for the end of the app1 workshop shows 60% test coverage for the completions_controller and I can’t find the difference to explain why Josh gets 100% when he runs it. I’ve gone over much fo the video and can’t find what I’m missing.
Is there a way to get the finished project so that I can do a diff and find out what I missed? I’d like to see how this was tested.
I’m actually wondering if there’s something else going on. The code is:
def create
todo = current_user.todos.find(params[:todo_id])
todo.touch :completed_at
redirect_to todos_path
end
and SimpleCov reports that the first line of this method has been tested, but not the last two. That makes no sense to me as the first line is a smple sequential statement and should fall right through to the last two. The app does what’s expected in the browser, too. [Edited to format code better]
Thanks… Is there a chance to get the finished class project as Josn worked it – that way I can compare mine and see what I’m missing. Excellent program; thanks!
@JESii I just ran this locally and am seeing 100% code coverage when running rake. Are you running the full rake command when you’re generating coverage or just rspec path/to/file? If you run the rspec command, you’ll not get an accurate representation of your coverage because you’re only running a subsection of your entire application, whereas rake will run the entire RSpec suite.