Are rspec controller tests in a Rails 5 Api still common?

349 Views Asked by At

I try to setup a new Rails 5.2.1 "Api only"-app.

While following some tutorials I was surprised that a lot of them (if not all) are only writing request specs. What I also found is the type: :api option in some of their tutorials.

What is the difference in type: :request and type: :api ?

  1. So I am a bit confused. Is this common practice to drop controller specs?
  2. Or is logic tested in request specs instead of controller specs?, because of no view logic?

    RSpec.describe 'Authentications', type: :request do
     ...
    end
    
    RSpec.describe UsersController, type: :api do
     ...
    end
    

Thank you in advance

0

There are 0 best solutions below