Search code examples
ruby-on-railsrspec

What are valid values for rspec :type?


In an rspec test, it is possible to specify the type of the test e.g.

it 'should behave', type: :system do
   ...
end

What are the valid values of :type, if so, where is it documented.


Solution

  • From the RSpec documentation

    - Model specs: type: `:model`
    - Controller specs: type: `:controller`
    - Request specs: type: `:request`
    - Feature specs: type: `:feature`
    - View specs: type: `:view`
    - Helper specs: type: `:helper`
    - Mailer specs: type: `:mailer`
    - Routing specs: type: `:routing`
    - Job specs: type: `:job`
    - System specs: type: `:system`
    

    Also, as commented by arieljuod, you can have custom spec types