ruby-on-railsrubyrspecrswag

How to disable testing of rswag files with rspec, but only use them for documentation?


I have problem with rswag spec/integration/*_spec.rb files witch goes in the main thread when I run rspec. In my project I use rswag lib only for creating documentation but not testing. Result: rspec - run all tests except rswag. And rake rswag run only spec/integration/* for documentation.


Solution

  • The quickest solution I could figure out was running tests under a specific folder. In my case I have integration tests under spec/ folder and rswag tests under spec/requests/, so I can do it like this: rspec --pattern spec/*_spec.rb

    In your case should be rspec --pattern spec/integration/*_spec.rb.

    See more about the --pattern option here.