How to run a single RSpec test?

后端 未结 17 670

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:31

    There are many options:

    rspec spec                           # All specs
    rspec spec/models                    # All specs in the models directory
    rspec spec/models/a_model_spec.rb    # All specs in the some_model model spec
    rspec spec/models/a_model_spec.rb:nn # Run the spec that includes line 'nn'
    rspec -e"text from a test"           # Runs specs that match the text
    rspec spec --tag focus               # Runs specs that have :focus => true
    rspec spec --tag focus:special       # Run specs that have :focus => special
    rspec spec --tag focus ~skip         # Run tests except those with :focus => true
    

提交回复
热议问题