How to run a single RSpec test?

后端 未结 17 792

I have the following file:

/spec/controllers/groups_controller_spec.rb

What command in terminal do I use to run just that spec and in what

17条回答
  •  粉色の甜心
    2020-12-04 05:06

    In rails 5,

    I used this way to run single test file(all the tests in one file)

    rails test -n /TopicsControllerTest/ -v
    

    Class name can be used to match to the desired file TopicsControllerTest

    My class class TopicsControllerTest < ActionDispatch::IntegrationTest

    Output :

    If You want you can tweak the regex to match to single test method \TopicsControllerTest#test_Should_delete\

    rails test -n /TopicsControllerTest#test_Should_delete/ -v
    

提交回复
热议问题