How to run a single RSpec test?

后端 未结 17 784

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

    With Rake:

    rake spec SPEC=path/to/spec.rb
    

    (Credit goes to this answer. Go vote him up.)

    EDIT (thanks to @cirosantilli): To run one specific scenario within the spec, you have to supply a regex pattern match that matches the description.

    rake spec SPEC=path/to/spec.rb \
              SPEC_OPTS="-e \"should be successful and return 3 items\""
    

提交回复
热议问题