Missing some test coverage in app1

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]

Sorry you’re having trouble with this.

@joshclayton is teaching a workshop today, but I suspect he’ll be able to help you with this tomorrow.

Hang tight!

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!

Not sure, but that’s definitely something we should give you access to.

I’ll make a note to get it added to the workshop page.

I know it doesn’t solve your problem now, but hopefully @joshclayton can help next week.

Thanks. Certainly not a big issue; I just hate to leave without understanding what I did wrong.

@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.

Thanks, Josh… that must have been the problem because now I get 100%.