ruby-on-railsrspecsimplecov

Simplecov wants me to test controller assignments, is there a way to do this without the rails-controller-testing gem?


For a very basic controller action such as:

def new
  @user = User.new
end

Simplecov wants this assignment tested. I can't think of anyway to test it other than using the rails-controller-testing gem which seems iffy since this seems pretty useless to test and not worth installing a gem.

I suspect the correct answer here is to just ignore simplecov, but for the sake of argument if I really want to get 100% coverage, is there any way to actually test this with stock rspec?


Solution

  • So to resolve this, it seems like my issue was actually with SimpleCov and Rails 8 beta and simplecov was giving incorrect coverage reports, and it has fixed itself with the final release of rails 8.