Search code examples
ruby-on-railstestingruby-on-rails-5system-testingruby-on-rails-5.1

Run single system test


To run a single test in Rails, we normally do:

rails test TEST=test/system/invitation_test.rb

But that doesn't work with system tests. Neither do this work:

rails test:system TEST=test/system/invitation_test.rb

With both those commandos above, all system tests (files) are run.

So my question is, how can I run a single system test?


As a side note, to run (all) system tests in Rails, you need to append :system to test.

rails test:system

Solution

  • While rails test doesn't seem to work if you want to run your system tests (you need to append test with :system), if you only want to run a single test it does seem to work:

    rails test test/system/my_little_test.rb